blob: 0e27dc9e5ffafc1c02ccafed431bb7c5659c45d2 [file] [log] [blame]
RouteBase get $nullableRequiredParamNotInPath => GoRouteData.$route(
path: 'bob',
factory: $NullableRequiredParamNotInPathExtension._fromState,
);
extension $NullableRequiredParamNotInPathExtension
on NullableRequiredParamNotInPath {
static NullableRequiredParamNotInPath _fromState(GoRouterState state) =>
NullableRequiredParamNotInPath(
id: _$convertMapValue('id', state.uri.queryParameters, int.parse),
);
String get location => GoRouteData.$location(
'bob',
queryParams: {
if (id != null) 'id': id!.toString(),
},
);
void go(BuildContext context) => context.go(location);
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
void replace(BuildContext context) => context.replace(location);
}
T? _$convertMapValue<T>(
String key,
Map<String, String> map,
T Function(String) converter,
) {
final value = map[key];
return value == null ? null : converter(value);
}