mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-12-30 18:16:20 -05:00
23 lines
662 B
Dart
23 lines
662 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
import '../pages/pages.dart';
|
|
import 'router_notifier.dart';
|
|
|
|
final _key = GlobalKey<NavigatorState>(debugLabel: 'routerKey');
|
|
|
|
/// This simple provider caches our GoRouter.
|
|
final routerProvider = Provider.autoDispose<GoRouter>((ref) {
|
|
final notifier = ref.watch(routerNotifierProvider.notifier);
|
|
|
|
return GoRouter(
|
|
navigatorKey: _key,
|
|
refreshListenable: notifier,
|
|
debugLogDiagnostics: true,
|
|
initialLocation: IndexPage.path,
|
|
routes: notifier.routes,
|
|
redirect: notifier.redirect,
|
|
);
|
|
});
|