native_page_route 1.0.0 native_page_route: ^1.0.0 copied to clipboard
Wraps creation of native page route in simple function. Also provide function with preventing of creation the same route twice. Is fully tested on mobile.
import 'package:flutter/material.dart';
import 'package:native_page_route_example/router.dart';
class NavigationService {
static GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
}
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Native route example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
navigatorKey: NavigationService.navigatorKey,
initialRoute: RouteKeys.firstScreen,
onGenerateRoute: AppRouter,
);
}
}