This package lets you navigate through screens and named routes without context in Flutter.
add sailor_plus
as a dependency in your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
sailor_plus: 1.0.1
Next, import 'sailor_plus.dart'
import 'package:sailor_plus/sailor_plus.dart';
and finally make sure to set navigatorKey in your main.dart
MaterialApp(
navigatorKey: Sailor.navigatorKey,
)
To navigate to another screen or page:
Sailor.to(AnotherPage());
To navigate using named routes:
Sailor.toNamed("new_route");
To go back to the previous page or route:
Sailor.back();