Jonny Borges

solving dart migrate errors pt 2

@@ -14,12 +14,14 @@ class GetCupertinoApp extends StatelessWidget { @@ -14,12 +14,14 @@ class GetCupertinoApp extends StatelessWidget {
14 this.theme, 14 this.theme,
15 this.navigatorKey, 15 this.navigatorKey,
16 this.home, 16 this.home,
17 - Map<String, Widget Function(BuildContext)> this.routes = const <String, WidgetBuilder>{}, 17 + Map<String, Widget Function(BuildContext)> this.routes =
  18 + const <String, WidgetBuilder>{},
18 this.initialRoute, 19 this.initialRoute,
19 this.onGenerateRoute, 20 this.onGenerateRoute,
20 this.onGenerateInitialRoutes, 21 this.onGenerateInitialRoutes,
21 this.onUnknownRoute, 22 this.onUnknownRoute,
22 - List<NavigatorObserver> this.navigatorObservers = const <NavigatorObserver>[], 23 + List<NavigatorObserver> this.navigatorObservers =
  24 + const <NavigatorObserver>[],
23 this.builder, 25 this.builder,
24 this.translationsKeys, 26 this.translationsKeys,
25 this.translations, 27 this.translations,
@@ -58,15 +60,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -58,15 +60,7 @@ class GetCupertinoApp extends StatelessWidget {
58 this.highContrastTheme, 60 this.highContrastTheme,
59 this.highContrastDarkTheme, 61 this.highContrastDarkTheme,
60 this.actions, 62 this.actions,
61 - }) : assert(routes != null),  
62 - assert(navigatorObservers != null),  
63 - assert(title != null),  
64 - assert(showPerformanceOverlay != null),  
65 - assert(checkerboardRasterCacheImages != null),  
66 - assert(checkerboardOffscreenLayers != null),  
67 - assert(showSemanticsDebugger != null),  
68 - assert(debugShowCheckedModeBanner != null),  
69 - routeInformationProvider = null, 63 + }) : routeInformationProvider = null,
70 routeInformationParser = null, 64 routeInformationParser = null,
71 routerDelegate = null, 65 routerDelegate = null,
72 backButtonDispatcher = null, 66 backButtonDispatcher = null,
@@ -103,7 +97,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -103,7 +97,7 @@ class GetCupertinoApp extends StatelessWidget {
103 final ThemeData? highContrastTheme; 97 final ThemeData? highContrastTheme;
104 final ThemeData? highContrastDarkTheme; 98 final ThemeData? highContrastDarkTheme;
105 final Map<Type, Action<Intent>>? actions; 99 final Map<Type, Action<Intent>>? actions;
106 - final Function(Routing)? routingCallback; 100 + final Function(Routing?)? routingCallback;
107 final Transition? defaultTransition; 101 final Transition? defaultTransition;
108 final bool? opaqueRoute; 102 final bool? opaqueRoute;
109 final VoidCallback? onInit; 103 final VoidCallback? onInit;
@@ -169,15 +163,7 @@ class GetCupertinoApp extends StatelessWidget { @@ -169,15 +163,7 @@ class GetCupertinoApp extends StatelessWidget {
169 this.defaultGlobalState, 163 this.defaultGlobalState,
170 this.getPages, 164 this.getPages,
171 this.unknownRoute, 165 this.unknownRoute,
172 - }) : assert(routeInformationParser != null),  
173 - assert(routerDelegate != null),  
174 - assert(title != null),  
175 - assert(showPerformanceOverlay != null),  
176 - assert(checkerboardRasterCacheImages != null),  
177 - assert(checkerboardOffscreenLayers != null),  
178 - assert(showSemanticsDebugger != null),  
179 - assert(debugShowCheckedModeBanner != null),  
180 - navigatorObservers = null, 166 + }) : navigatorObservers = null,
181 navigatorKey = null, 167 navigatorKey = null,
182 onGenerateRoute = null, 168 onGenerateRoute = null,
183 home = null, 169 home = null,
@@ -248,21 +234,19 @@ class GetCupertinoApp extends StatelessWidget { @@ -248,21 +234,19 @@ class GetCupertinoApp extends StatelessWidget {
248 child: builder == null ? child! : builder!(context, child), 234 child: builder == null ? child! : builder!(context, child),
249 ); 235 );
250 }, 236 },
251 - title: title ?? '', 237 + title: title,
252 onGenerateTitle: onGenerateTitle, 238 onGenerateTitle: onGenerateTitle,
253 color: color, 239 color: color,
254 locale: Get.locale ?? locale, 240 locale: Get.locale ?? locale,
255 localizationsDelegates: localizationsDelegates, 241 localizationsDelegates: localizationsDelegates,
256 localeListResolutionCallback: localeListResolutionCallback, 242 localeListResolutionCallback: localeListResolutionCallback,
257 localeResolutionCallback: localeResolutionCallback, 243 localeResolutionCallback: localeResolutionCallback,
258 - supportedLocales:  
259 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
260 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
261 - checkerboardRasterCacheImages:  
262 - checkerboardRasterCacheImages ?? false,  
263 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
264 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
265 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 244 + supportedLocales: supportedLocales,
  245 + showPerformanceOverlay: showPerformanceOverlay,
  246 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  247 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  248 + showSemanticsDebugger: showSemanticsDebugger,
  249 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
266 shortcuts: shortcuts, 250 shortcuts: shortcuts,
267 ) 251 )
268 : CupertinoApp( 252 : CupertinoApp(
@@ -295,21 +279,19 @@ class GetCupertinoApp extends StatelessWidget { @@ -295,21 +279,19 @@ class GetCupertinoApp extends StatelessWidget {
295 child: builder == null ? child! : builder!(context, child), 279 child: builder == null ? child! : builder!(context, child),
296 ); 280 );
297 }, 281 },
298 - title: title ?? '', 282 + title: title,
299 onGenerateTitle: onGenerateTitle, 283 onGenerateTitle: onGenerateTitle,
300 color: color, 284 color: color,
301 locale: Get.locale ?? locale, 285 locale: Get.locale ?? locale,
302 localizationsDelegates: localizationsDelegates, 286 localizationsDelegates: localizationsDelegates,
303 localeListResolutionCallback: localeListResolutionCallback, 287 localeListResolutionCallback: localeListResolutionCallback,
304 localeResolutionCallback: localeResolutionCallback, 288 localeResolutionCallback: localeResolutionCallback,
305 - supportedLocales:  
306 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
307 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
308 - checkerboardRasterCacheImages:  
309 - checkerboardRasterCacheImages ?? false,  
310 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
311 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
312 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 289 + supportedLocales: supportedLocales,
  290 + showPerformanceOverlay: showPerformanceOverlay,
  291 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  292 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  293 + showSemanticsDebugger: showSemanticsDebugger,
  294 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
313 shortcuts: shortcuts, 295 shortcuts: shortcuts,
314 // actions: actions, 296 // actions: actions,
315 )); 297 ));
@@ -13,12 +13,14 @@ class GetMaterialApp extends StatelessWidget { @@ -13,12 +13,14 @@ class GetMaterialApp extends StatelessWidget {
13 Key? key, 13 Key? key,
14 this.navigatorKey, 14 this.navigatorKey,
15 this.home, 15 this.home,
16 - Map<String, Widget Function(BuildContext)> this.routes = const <String, WidgetBuilder>{}, 16 + Map<String, Widget Function(BuildContext)> this.routes =
  17 + const <String, WidgetBuilder>{},
17 this.initialRoute, 18 this.initialRoute,
18 this.onGenerateRoute, 19 this.onGenerateRoute,
19 this.onGenerateInitialRoutes, 20 this.onGenerateInitialRoutes,
20 this.onUnknownRoute, 21 this.onUnknownRoute,
21 - List<NavigatorObserver> this.navigatorObservers = const <NavigatorObserver>[], 22 + List<NavigatorObserver> this.navigatorObservers =
  23 + const <NavigatorObserver>[],
22 this.builder, 24 this.builder,
23 this.textDirection, 25 this.textDirection,
24 this.title = '', 26 this.title = '',
@@ -61,16 +63,7 @@ class GetMaterialApp extends StatelessWidget { @@ -61,16 +63,7 @@ class GetMaterialApp extends StatelessWidget {
61 this.highContrastTheme, 63 this.highContrastTheme,
62 this.highContrastDarkTheme, 64 this.highContrastDarkTheme,
63 this.actions, 65 this.actions,
64 - }) : assert(routes != null),  
65 - assert(navigatorObservers != null),  
66 - assert(title != null),  
67 - assert(debugShowMaterialGrid != null),  
68 - assert(showPerformanceOverlay != null),  
69 - assert(checkerboardRasterCacheImages != null),  
70 - assert(checkerboardOffscreenLayers != null),  
71 - assert(showSemanticsDebugger != null),  
72 - assert(debugShowCheckedModeBanner != null),  
73 - routeInformationProvider = null, 66 + }) : routeInformationProvider = null,
74 routeInformationParser = null, 67 routeInformationParser = null,
75 routerDelegate = null, 68 routerDelegate = null,
76 backButtonDispatcher = null, 69 backButtonDispatcher = null,
@@ -111,7 +104,7 @@ class GetMaterialApp extends StatelessWidget { @@ -111,7 +104,7 @@ class GetMaterialApp extends StatelessWidget {
111 final ThemeData? highContrastDarkTheme; 104 final ThemeData? highContrastDarkTheme;
112 final Map<Type, Action<Intent>>? actions; 105 final Map<Type, Action<Intent>>? actions;
113 final bool debugShowMaterialGrid; 106 final bool debugShowMaterialGrid;
114 - final ValueChanged<Routing>? routingCallback; 107 + final ValueChanged<Routing?>? routingCallback;
115 final Transition? defaultTransition; 108 final Transition? defaultTransition;
116 final bool? opaqueRoute; 109 final bool? opaqueRoute;
117 final VoidCallback? onInit; 110 final VoidCallback? onInit;
@@ -179,16 +172,7 @@ class GetMaterialApp extends StatelessWidget { @@ -179,16 +172,7 @@ class GetMaterialApp extends StatelessWidget {
179 this.defaultGlobalState, 172 this.defaultGlobalState,
180 this.getPages, 173 this.getPages,
181 this.unknownRoute, 174 this.unknownRoute,
182 - }) : assert(routeInformationParser != null),  
183 - assert(routerDelegate != null),  
184 - assert(title != null),  
185 - assert(debugShowMaterialGrid != null),  
186 - assert(showPerformanceOverlay != null),  
187 - assert(checkerboardRasterCacheImages != null),  
188 - assert(checkerboardOffscreenLayers != null),  
189 - assert(showSemanticsDebugger != null),  
190 - assert(debugShowCheckedModeBanner != null),  
191 - navigatorObservers = null, 175 + }) : navigatorObservers = null,
192 navigatorKey = null, 176 navigatorKey = null,
193 onGenerateRoute = null, 177 onGenerateRoute = null,
194 home = null, 178 home = null,
@@ -257,25 +241,23 @@ class GetMaterialApp extends StatelessWidget { @@ -257,25 +241,23 @@ class GetMaterialApp extends StatelessWidget {
257 child: builder == null ? child! : builder!(context, child), 241 child: builder == null ? child! : builder!(context, child),
258 ); 242 );
259 }, 243 },
260 - title: title ?? '', 244 + title: title,
261 onGenerateTitle: onGenerateTitle, 245 onGenerateTitle: onGenerateTitle,
262 color: color, 246 color: color,
263 theme: _.theme ?? theme ?? ThemeData.fallback(), 247 theme: _.theme ?? theme ?? ThemeData.fallback(),
264 darkTheme: darkTheme, 248 darkTheme: darkTheme,
265 - themeMode: _.themeMode ?? themeMode ?? ThemeMode.system, 249 + themeMode: _.themeMode ?? themeMode,
266 locale: Get.locale ?? locale, 250 locale: Get.locale ?? locale,
267 localizationsDelegates: localizationsDelegates, 251 localizationsDelegates: localizationsDelegates,
268 localeListResolutionCallback: localeListResolutionCallback, 252 localeListResolutionCallback: localeListResolutionCallback,
269 localeResolutionCallback: localeResolutionCallback, 253 localeResolutionCallback: localeResolutionCallback,
270 - supportedLocales:  
271 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
272 - debugShowMaterialGrid: debugShowMaterialGrid ?? false,  
273 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
274 - checkerboardRasterCacheImages:  
275 - checkerboardRasterCacheImages ?? false,  
276 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
277 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
278 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 254 + supportedLocales: supportedLocales,
  255 + debugShowMaterialGrid: debugShowMaterialGrid,
  256 + showPerformanceOverlay: showPerformanceOverlay,
  257 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  258 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  259 + showSemanticsDebugger: showSemanticsDebugger,
  260 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
279 shortcuts: shortcuts, 261 shortcuts: shortcuts,
280 ) 262 )
281 : MaterialApp( 263 : MaterialApp(
@@ -307,25 +289,23 @@ class GetMaterialApp extends StatelessWidget { @@ -307,25 +289,23 @@ class GetMaterialApp extends StatelessWidget {
307 child: builder == null ? child! : builder!(context, child), 289 child: builder == null ? child! : builder!(context, child),
308 ); 290 );
309 }, 291 },
310 - title: title ?? '', 292 + title: title,
311 onGenerateTitle: onGenerateTitle, 293 onGenerateTitle: onGenerateTitle,
312 color: color, 294 color: color,
313 theme: _.theme ?? theme ?? ThemeData.fallback(), 295 theme: _.theme ?? theme ?? ThemeData.fallback(),
314 darkTheme: darkTheme, 296 darkTheme: darkTheme,
315 - themeMode: _.themeMode ?? themeMode ?? ThemeMode.system, 297 + themeMode: _.themeMode ?? themeMode,
316 locale: Get.locale ?? locale, 298 locale: Get.locale ?? locale,
317 localizationsDelegates: localizationsDelegates, 299 localizationsDelegates: localizationsDelegates,
318 localeListResolutionCallback: localeListResolutionCallback, 300 localeListResolutionCallback: localeListResolutionCallback,
319 localeResolutionCallback: localeResolutionCallback, 301 localeResolutionCallback: localeResolutionCallback,
320 - supportedLocales:  
321 - supportedLocales ?? const <Locale>[Locale('en', 'US')],  
322 - debugShowMaterialGrid: debugShowMaterialGrid ?? false,  
323 - showPerformanceOverlay: showPerformanceOverlay ?? false,  
324 - checkerboardRasterCacheImages:  
325 - checkerboardRasterCacheImages ?? false,  
326 - checkerboardOffscreenLayers: checkerboardOffscreenLayers ?? false,  
327 - showSemanticsDebugger: showSemanticsDebugger ?? false,  
328 - debugShowCheckedModeBanner: debugShowCheckedModeBanner ?? true, 302 + supportedLocales: supportedLocales,
  303 + debugShowMaterialGrid: debugShowMaterialGrid,
  304 + showPerformanceOverlay: showPerformanceOverlay,
  305 + checkerboardRasterCacheImages: checkerboardRasterCacheImages,
  306 + checkerboardOffscreenLayers: checkerboardOffscreenLayers,
  307 + showSemanticsDebugger: showSemanticsDebugger,
  308 + debugShowCheckedModeBanner: debugShowCheckedModeBanner,
329 shortcuts: shortcuts, 309 shortcuts: shortcuts,
330 // actions: actions, 310 // actions: actions,
331 )); 311 ));
1 -import '../../../get_core/src/get_main.dart'; 1 +import 'package:collection/collection.dart' show IterableExtension;
2 2
  3 +import '../../../get_core/src/get_main.dart';
3 import '../../get_navigation.dart'; 4 import '../../get_navigation.dart';
4 import '../routes/get_route.dart'; 5 import '../routes/get_route.dart';
5 -import 'package:collection/collection.dart' show IterableExtension;  
6 6
7 class RouteDecoder { 7 class RouteDecoder {
8 final GetPage? route; 8 final GetPage? route;
9 - final Map<String?, String> parameters; 9 + final Map<String, String?> parameters;
10 const RouteDecoder(this.route, this.parameters); 10 const RouteDecoder(this.route, this.parameters);
11 } 11 }
12 12
@@ -16,10 +16,10 @@ class ParseRouteTree { @@ -16,10 +16,10 @@ class ParseRouteTree {
16 RouteDecoder matchRoute(String name) { 16 RouteDecoder matchRoute(String name) {
17 final uri = Uri.parse(name); 17 final uri = Uri.parse(name);
18 final route = _findRoute(uri.path); 18 final route = _findRoute(uri.path);
19 - final params = Map<String?, String>.from(uri.queryParameters); 19 + final params = Map<String, String?>.from(uri.queryParameters);
20 if (route != null) { 20 if (route != null) {
21 final parsedParams = _parseParams(name, route.path); 21 final parsedParams = _parseParams(name, route.path);
22 - if (parsedParams != null && parsedParams.isNotEmpty) { 22 + if (parsedParams.isNotEmpty) {
23 params.addAll(parsedParams); 23 params.addAll(parsedParams);
24 } 24 }
25 } else { 25 } else {
@@ -95,13 +95,13 @@ class ParseRouteTree { @@ -95,13 +95,13 @@ class ParseRouteTree {
95 ); 95 );
96 } 96 }
97 97
98 - Map<String?, String> _parseParams(String path, PathDecoded routePath) {  
99 - final params = <String?, String>{}; 98 + Map<String, String?> _parseParams(String path, PathDecoded routePath) {
  99 + final params = <String, String?>{};
100 Match? paramsMatch = routePath.regex.firstMatch(path); 100 Match? paramsMatch = routePath.regex.firstMatch(path);
101 101
102 for (var i = 0; i < routePath.keys.length; i++) { 102 for (var i = 0; i < routePath.keys.length; i++) {
103 var param = Uri.decodeQueryComponent(paramsMatch![i + 1]!); 103 var param = Uri.decodeQueryComponent(paramsMatch![i + 1]!);
104 - params[routePath.keys[i]] = param; 104 + params[routePath.keys[i]!] = param;
105 } 105 }
106 return params; 106 return params;
107 } 107 }
@@ -25,9 +25,9 @@ class GetMaterialController extends GetxController { @@ -25,9 +25,9 @@ class GetMaterialController extends GetxController {
25 25
26 final routing = Routing(); 26 final routing = Routing();
27 27
28 - Map<String?, String> parameters = {}; 28 + Map<String, String?> parameters = {};
29 29
30 - ParseRouteTree? routeTree; 30 + late ParseRouteTree routeTree;
31 31
32 CustomTransition? customTransition; 32 CustomTransition? customTransition;
33 33
@@ -493,11 +493,9 @@ class _CupertinoBackGestureDetectorState<T> @@ -493,11 +493,9 @@ class _CupertinoBackGestureDetectorState<T>
493 return -value; 493 return -value;
494 case TextDirection.ltr: 494 case TextDirection.ltr:
495 return value; 495 return value;
  496 + default:
  497 + return value;
496 } 498 }
497 - // FIXME: shouldn't we return a default here?  
498 - // or perhaps throw error  
499 - // ignore: avoid_returning_null  
500 - return null;  
501 } 499 }
502 500
503 @override 501 @override
@@ -579,7 +577,8 @@ class _CupertinoBackGestureController<T> { @@ -579,7 +577,8 @@ class _CupertinoBackGestureController<T> {
579 _kMaxDroppedSwipePageForwardAnimationTime, 577 _kMaxDroppedSwipePageForwardAnimationTime,
580 0, 578 0,
581 controller.value, 579 controller.value,
582 - )!.floor(), 580 + )!
  581 + .floor(),
583 _kMaxPageBackAnimationTime, 582 _kMaxPageBackAnimationTime,
584 ); 583 );
585 controller.animateTo(1.0, 584 controller.animateTo(1.0,
@@ -597,7 +596,8 @@ class _CupertinoBackGestureController<T> { @@ -597,7 +596,8 @@ class _CupertinoBackGestureController<T> {
597 0, 596 0,
598 _kMaxDroppedSwipePageForwardAnimationTime, 597 _kMaxDroppedSwipePageForwardAnimationTime,
599 controller.value, 598 controller.value,
600 - )!.floor(); 599 + )!
  600 + .floor();
601 controller.animateBack( 601 controller.animateBack(
602 0.0, 602 0.0,
603 duration: Duration(milliseconds: droppedPageBackAnimationTime), 603 duration: Duration(milliseconds: droppedPageBackAnimationTime),