lukepighetti / fluro

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
https://pub.dev/packages/fluro
MIT License
3.66k stars 416 forks source link

A GlobalKey was used multiple times inside one widget's child list. #272

Closed behnamjk closed 2 years ago

behnamjk commented 2 years ago

I can navigate to my page correctly for the first time however reload page url in flutter web throw this error :

A GlobalKey was used multiple times inside one widget's child list. The offending GlobalKey was: [GlobalobjectKey _WidgetsAppState#9e1cc] The parent of the widgets with that key was:
IconTheme The first child to get instantiated with that key became :
Navigator-[GlobalobjectKey _WidgetsAppState#9e1cc] The second child that was to be instantiated with that key was:
IconTheme A GlobalKey can only be specified on one widget at a time in the widget tree. See also: https://flutter.dev/docs/testing/errors

this is my Handler :

  static Handler orderScreenHandler = Handler(
      handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
    var status = params['status']?.first;
    var trackId = params['track_id']?.first;
    var id = params['id']?.first;
    var orderId = params['order_id']?.first;
    var branchId = params['_branch_match_id']?.first;
    var utm = params['utm_medium']?.first;
    var branchRef = params['_branch_referrer']?.first;

    return OrderScreen();
  });

and here is my route define method :

static void setupRouter(FluroRouter router) {
    router.define(
      '/',
      handler: rootHandler,
    );
    router.define(
      '/order-screen/',
      handler: orderScreenHandler,
    );
    router.define(
      '/profile/',
      handler: createProfileHandler,
    );

  }
Screen Shot 2022-06-15 at 8 49 32 PM
behnamjk commented 2 years ago

I solved my problem after remove '/' at the end of route name