-
-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Describe the bug
Bad State: no element
exception after web app reload (starting it works smoothly)
Beamer version: 1.6.0 (and 2.0.0-dev.1)
To Reproduce
Steps to reproduce the behavior:
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
final routerDelegate = BeamerDelegate(
locationBuilder: RoutesLocationBuilder(
routes: {
'/': (context, state, data) => const MainWidget(""),
'/bot/:botId': (context, state, data) {
final botId = state.pathParameters['botId']!;
return MainWidget(botId);
}
},
).call,
);
return MaterialApp.router(
routeInformationParser: BeamerParser(),
routerDelegate: routerDelegate,
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
);
}
}
For this code, I get the following exception - but only when reloading the web app
When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:3 throw_
dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 356:5 last]
packages/beamer/src/beamer_delegate.dart 975:35 [_setBrowserTitle]
packages/beamer/src/beamer_delegate.dart 760:9 <fn>
packages/flutter/src/widgets/basic.dart 7682:48 build
packages/flutter/src/widgets/framework.dart 5541:22 build
...
which is this code
void _setBrowserTitle(BuildContext context) {
if (active && kIsWeb && setBrowserTabTitle) {
SystemChrome.setApplicationSwitcherDescription(
ApplicationSwitcherDescription(
EXC--> label: _currentPages.last.title ??
currentBeamLocation.state.routeInformation.uri.path,
primaryColor: Theme.of(context).primaryColor.value,
));
}
}
Expected behavior
No Exception :-)
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- Browser: Chrome
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels