NRouter class

Example:

final router = NRouter( ... );
...
final app = MaterialApp(
  restorationScopeId: 'restore Id', // immutable
  builder: (context, child) {
   return router.build(context);
},
 title: 'router demo',
);

or:

final app = MaterialApp.router(
  restorationScopeId: 'restore Id', // immutable
  routerConfig: router,
  title: 'router demo',
);
Implemented types

Constructors

NRouter({required NPageMain rootPage, String? restorationId, Map<String, dynamic> params = const {}, Map<String, dynamic>? extra, Object? groupId, List<NavigatorObserver> observers = const [], bool updateLocation = false})

Properties

backButtonDispatcher BackButtonDispatcher?
The BackButtonDispatcher that is used to configure the Router.
final
globalDependence NRouterGlobalDependence
no setter
hashCode int
The hash code for this object.
no setterinherited
observers List<NavigatorObserver>
final
rootPage NPageMain
final
routeInformationParser RouteInformationParser<RouteQueue>?
The RouteInformationParser that is used to configure the Router.
no setteroverride
routeInformationProvider RouteInformationProvider?
The RouteInformationProvider that is used to configure the Router.
no setteroverride
routerDelegate NRouterDelegate
The RouterDelegate that is used to configure the Router.
latefinaloverride-getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
updateLocation bool
final

Methods

addAlias<P, C extends P>() → void
子类可以转化成父类
inherited
addAliasAll<P extends Type, C extends P>(Iterable<P> parents, C child) → void
inherited
build(BuildContext context) Widget
MaterialApp.builder 中使用
canPop() bool
clear() → void
createNode(Route route) NRouterDependence
didPop(Route route) → void
inherited
didRemove(Route route) → void
inherited
find<T>({BuildContext? context, Object? group, bool useEntryGroup = true}) → T?
get<T>() → BuildFactory<T>
inherited
getAlias(Type t) Type
inherited
getArg(Type t) → BuildFactory
inherited
getEntryFromId(int id) RouteQueueEntry?
getRouteDependence(BuildContext? context) NRouterDependence?
inherited
global<T>({Object? group, int? position = 0}) → T
go(String location, {Map<String, dynamic> params = const {}, Map<String, dynamic>? extra, Object? groupId}) RouteQueueEntry
goPage(NPage page, {Map<String, dynamic> params = const {}, Map<String, dynamic>? extra, Object? groupId}) RouteQueueEntry
goUntil(String location, UntilFn until) RouteQueueEntry
grass<T>({BuildContext? context, Object? group, bool useEntryGroup = true, int? position = 0}) → T
isValid(String location) bool
根据给出路径判断是否有效
maybePop([Object? result]) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ofEntry(BuildContext context) RouteQueueEntry?
pop([Object? result]) → void
popUntil(UntilFn test, {bool ignore = false}) → void
popUntilNav(UntilFn test, {bool routeTest(Route route)?}) → void
put<T>(BuildFactory<T> factory) → void
inherited
removeCurrent(BuildContext context, [dynamic result]) bool
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) NRouter?
of(BuildContext context) NRouter