-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworka: state restorationRestorationManager and related APIsRestorationManager and related APIsc: crashStack traces logged to the consoleStack traces logged to the consolef: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packageThe go_router_builder packageplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
I'm just trying to create a router that goes from the login page to the home page.
To Reproduce
- flutter run the code below
- Fill in an email and password and click login
- See the following error:
══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY
╞════════════════════════════════════════════════════════
The following assertion was thrown while dispatching notifications for
_RestorableRouteInformation:
'package:flutter/src/services/restoration.dart': Failed assertion: line 661 pos 12:
'debugIsSerializableForRestoration(value)': is not true.
MyApp
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp(base: Uri.base));
}
class MyApp extends StatelessWidget {
const MyApp({required this.base, super.key});
final Uri base;
@override
Widget build(BuildContext context) {
return MaterialApp.router(
debugShowCheckedModeBanner: false,
showSemanticsDebugger: false,
// *** ROUTES ***
restorationScopeId: 'root',
routeInformationParser: setupGoRouterCreator.routeInformationParser,
routerDelegate: setupGoRouterCreator.routerDelegate,
routeInformationProvider: setupGoRouterCreator.routeInformationProvider,
);
});
}
}LoginView
class LoginView extends StatelessWidget {
const LoginView({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
home: SafeArea(
child: Scaffold(
drawer: const NavigationDrawer(),
body: TextButton(
child: Column(
children: const [
Text('Title'),
],
),
onPressed: () {
TempRoute().go(context);
}))));tempView
class TempView extends StatelessWidget {
const TempView({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
home: SafeArea(
child: Scaffold(
drawer: const NavigationDrawer(),
body: TextButton(
child: Column(
children: const [
Text('Title'),
],
),
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const HomeView()),
)))));
}route_builder.dart
final setupGoRouterCreator = GoRouter(
initialLocation: '/login',
debugLogDiagnostics: !isProd,
restorationScopeId: 'root',
routes: $appRoutes,
);
@TypedGoRoute<LoginRoute>(path: '/login')
class LoginRoute extends GoRouteData {
@override
Widget build(BuildContext context) => const LoginView();
}
@TypedGoRoute<TempRoute>(path: '/temp')
class TempRoute extends GoRouteData {
@override
Widget build(BuildContext context) => const TempView();
}route_builder.g.dart
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'route_builder.dart';
// **************************************************************************
// GoRouterGenerator
// **************************************************************************
List<GoRoute> get $appRoutes => [
$loginRoute,
$tempRoute,
];
GoRoute get $loginRoute => GoRouteData.$route(
path: '/login',
factory: $LoginRouteExtension._fromState,
);
extension $LoginRouteExtension on LoginRoute {
static LoginRoute _fromState(GoRouterState state) => LoginRoute();
String get location => GoRouteData.$location(
'/login',
);
void go(BuildContext context) => context.go(location, extra: this);
void push(BuildContext context) => context.push(location, extra: this);
}
GoRoute get $tempRoute => GoRouteData.$route(
path: '/temp',
factory: $TempRouteExtension._fromState,
);
extension $TempRouteExtension on TempRoute {
static TempRoute _fromState(GoRouterState state) => TempRoute();
String get location => GoRouteData.$location(
'/temp',
);
void go(BuildContext context) => context.go(location, extra: this);
void push(BuildContext context) => context.push(location, extra: this);
}flutter doctor -v
[✓] Flutter (Channel stable, 3.3.1, on Ubuntu 22.04.1 LTS 5.15.0-43-generic, locale en_US.UTF-8)
• Flutter version 3.3.1 on channel stable at /home/grey/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4f9d92fbbd (12 days ago), 2022-09-06 17:54:53 -0700
• Engine revision 3efdf03e73
• Dart version 2.18.0
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/grey/Android/Sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /snap/android-studio/123/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
• cmake version 3.10.2
• ninja version 1.8.2
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.2)
• Android Studio at /snap/android-studio/123/android-studio
• Flutter plugin version 70.0.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code
• VS Code at /snap/code/current
• Flutter extension version 3.48.0
[✓] Connected device (3 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.1 LTS 5.15.0-43-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125
[✓] HTTP Host Availability
• All required HTTP hosts are available
cedvdb, nader138, Maatteogekko and ska2519ska2519
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: error messageError messages from the Flutter frameworkError messages from the Flutter frameworka: state restorationRestorationManager and related APIsRestorationManager and related APIsc: crashStack traces logged to the consoleStack traces logged to the consolef: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.found in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packageThe go_router_builder packageplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version