Move the page at the moment the app is opened with flutter and recieve_sharing_intent?

Viewed 14

I use receive_sharing_intent with flutter.
I use this and can't to move the page at the moment the app is opened.

this is my code.


class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    moveCategoryAddPage(context);

    return MaterialApp( ...);
  }

  void moveCategoryAddPage(BuildContext context) {
    ReceiveSharingIntent.getInitialMedia().then((value) => {
      if (value.isNotEmpty) {
        Navigator.push(context, MaterialPageRoute(builder: (_) => const CategoryAddScreen()))
      }
    });
  }

However, if I press the share button using the photo album while the app is open, it does not move to the desired page.

How can i go to the CategoryAddScreen when pick the picture?

0 Answers
Related