-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14frameworkflutter/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 onr: invalidIssue is closed as not validIssue is closed as not validteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
Trying to implement Navigator 2.0 and back button callbacks are not working.
MyRouterDelegate.popRoute() and MyBackButtonDispatcher.invokeCallback() are not being called
Code Sample provided
Expected results
call provided pop callbacks
Actual results
app closes
Code sample
Code sample
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) => MaterialApp.router(
routerConfig: RouterConfig<String>(
routerDelegate: MyRouterDelegate(),
backButtonDispatcher: MyBackButtonDispatcher(),
routeInformationParser: const MyRouteInformationParser(),
routeInformationProvider: MyRouteInformationProvider(),
),
);
}
void main() => runApp(const MyApp());
class MyRouteInformationParser extends RouteInformationParser<String> {
const MyRouteInformationParser() : super();
@override
SynchronousFuture<String> parseRouteInformation(
RouteInformation routeInformation,
) =>
SynchronousFuture("${routeInformation.uri}");
@override
RouteInformation restoreRouteInformation(String uri) => RouteInformation(
uri: Uri.parse(uri),
);
}
class MyBackButtonDispatcher extends BackButtonDispatcher {
@override
Future<bool> invokeCallback(Future<bool> defaultValue) async {
print("MyBackButtonDispatcher.invokeCallback");
return false;
}
}
class MyRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
@override
Widget build(BuildContext context) => const Scaffold(
body: Center(
child: Text("Pop Test"),
),
);
@override
Future<bool> popRoute() async {
print("popRoute");
return false;
}
@override
Future<void> setNewRoutePath(String configuration) async {}
}
class MyRouteInformationProvider extends RouteInformationProvider
with ChangeNotifier {
@override
RouteInformation get value => RouteInformation(
uri: Uri(),
);
}Screenshots or Video
Screenshots / Video demonstration
Screen.Recording.2023-09-19.at.12.08.24.mp4
and as you can see no prints:
Screen.Recording.2023-09-19.at.12.09.17.mp4
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.13.4, on macOS 13.5.2 22G91 darwin-x64, locale en-NO)
• Flutter version 3.13.4 on channel stable at /Users/username/fvm/versions/3.13.4
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 367f9ea16b (6 days ago), 2023-09-12 23:27:53 -0500
• Engine revision 9064459a8b
• Dart version 3.1.2
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/username/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.1
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] IntelliJ IDEA Community Edition (version 2023.2.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.82.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.72.0
[✓] Connected device (1 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
[✓] Network resources
• All expected network resources are available.
• No issues found!
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.found in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.14Found to occur in 3.14Found to occur in 3.14frameworkflutter/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 onr: invalidIssue is closed as not validIssue is closed as not validteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team