state.pathParameters is empty on Beamer Flutter

202 Views Asked by At

I have the following beamerDelegate:

beamerDelegate = BeamerDelegate(
    initialPath: '/',
    locationBuilder: RoutesLocationBuilder(
      routes: {
        '*': (context, state, data) => const Home(),
        '/search': (context, state, data) => const Home(),
        '/search/:acordaoId': (context, state, data) {
          //state.pathParameters is empty while
          //state.uri.path == '/search/STJ!f5abc41e506fd51580256fc70035f8bc'
          final tmp = state.pathParameters['acordaoId']!.split('!');
          final acordaoId = tmp[1];
          final court = tmp[0];
          if (data != null) {
            final cast = data as Map<String, dynamic>;
            final index = cast['index'] as int;
            return AcordaoDisplayer(acordaoId: acordaoId, court: court,
              index: index,);
          }
          else {
            return AcordaoDisplayer(acordaoId: acordaoId, court: court);
          }
        }
      }
    )
  );

Has shown in the comments in the code above state.pathParameters is empty when I go to /search/STJ!f5abc41e506fd51580256fc70035f8bc. Why is this happening?

0

There are 0 best solutions below