phase3(critical-path): store + main + routes + nav components null-safe
- store/state + reducers: nullable AppState fields & reducer types - main.dart: localeResolutionCallback Locale?, settings.name? guard - routes.dart: fluro 2.0.5 HandlerFunc (BuildContext?) + params['x']! - navigationbar/breadcrumbs/bottom_nav/text_link: nullable optional params/fields
This commit is contained in:
@@ -103,7 +103,11 @@ class MyApp extends StatelessWidget {
|
||||
S.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
localeResolutionCallback: (Locale locale, Iterable<Locale> supportedLocales) {
|
||||
localeResolutionCallback: (Locale? locale, Iterable<Locale> supportedLocales) {
|
||||
if (locale == null) {
|
||||
store.dispatch(UpdateLocale(supportedLocales.first));
|
||||
return supportedLocales.first;
|
||||
}
|
||||
print('Language code: ${locale.languageCode}, Country code: ${locale.countryCode}');
|
||||
for (final supportedLocale in supportedLocales) {
|
||||
if (supportedLocale.languageCode == locale.languageCode) {
|
||||
@@ -115,9 +119,9 @@ class MyApp extends StatelessWidget {
|
||||
return supportedLocales.first;
|
||||
},
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
final List<String> pathElements = settings.name.split('/');
|
||||
final List<String> pathElements = settings.name?.split('/') ?? [];
|
||||
print('path elements: $pathElements');
|
||||
if (pathElements[0] != '') {
|
||||
if (pathElements.isEmpty || pathElements[0] != '') {
|
||||
return null;
|
||||
}
|
||||
if (pathElements[1] == 'me') {
|
||||
|
||||
Reference in New Issue
Block a user