Nylo class
Constructors
Nylo ({NyRouter ? router , bool useNyRouteObserver = true })
Create a new Nylo instance.
Methods
addApiDecoders (Map <Type , dynamic > apiDecoders )
→ dynamic
Set API decoders
addControllers (Map <Type , dynamic > controllers )
→ dynamic
Add Controllers to your Nylo project.
addEventBus ({int maxHistoryLength = 10 , bool allowLogging = false })
→ dynamic
Add an EventBus to your Nylo project.
addEvents (Map <Type , NyEvent > events )
→ dynamic
Add events
to Nylo
addFormCasts (Map <String , dynamic > formTypes )
→ dynamic
Add form casts to Nylo
addFormStyle (NyFormStyle formStyle )
→ dynamic
Set the form style
addLoader (Widget appLoader )
→ dynamic
Add appLoader
addLogo (Widget appLogo )
→ dynamic
Add appLogo
addModelDecoders (Map <Type , dynamic > modelDecoders )
→ dynamic
Add modelDecoders
to Nylo
addNavigatorObserver (NavigatorObserver observer )
→ dynamic
Add a navigator observer.
addRouter (NyRouter router )
→ dynamic
Allows you to add additional Router's to your project.
addThemes <T extends BaseColorStyles > (List <BaseThemeConfig <T > > themes )
→ dynamic
Add themes to Nylo
addToastNotification (Widget toastNotification ({Function ? onDismiss , required ToastNotificationStyleType style , dynamic toastNotificationStyleMeta (ToastNotificationStyleMetaHelper helper )? }) )
→ dynamic
Add toast notification
addValidationRules (Map <String , dynamic > validators )
→ dynamic
Add validators
to Nylo
getApiDecoders ()
→ Map <Type , NyApiService Function() >
Get API decoders
getController (dynamic controller )
→ dynamic
Find a controller
getEvent (Type event )
→ NyEvent ?
Return an event.
getEvents ()
→ Map <Type , NyEvent >
Return all the registered events.
getFormCasts ()
→ Map <String , dynamic >
Get form types from Nylo
getFormStyle ()
→ NyFormStyle ?
Get the form style
getInitialRoute ()
→ String
Get the initial route.
getModelDecoders ()
→ Map <Type , dynamic >
Return all the registered events.
getNavigatorObservers ()
→ List <NavigatorObserver >
Return all the registered navigator observers.
getValidationRules ()
→ Map <String , dynamic >
Get validators
from Nylo
initRoutes ({String ? initialRoute })
→ void
Initialize routes
monitorAppUsage ()
→ dynamic
Set if the app should monitor app usage like:
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDeepLink (dynamic callback (String route , dynamic data ) )
→ dynamic
Set the deep link action.
e.g. nylo.onDeepLink((route, data) {
print("Deep link route: $route");
print("Deep link data: $data");
});
removeNavigatorObserver (NavigatorObserver observer )
→ dynamic
Remove a navigator observer.
setInitialRoute (String routeName )
→ dynamic
Set the initial route from a routeName
.
shouldMonitorAppUsage ()
→ bool
Check if the app should monitor app usage
shouldShowDateTimeInLogs ()
→ bool
Check if the app should show date time in logs
showDateTimeInLogs ()
→ dynamic
Show date time in logs
toString ()
→ String
A string representation of this object.
inherited
use (NyPlugin plugin )
→ dynamic
Assign a NyPlugin to add extra functionality to your app from a plugin.
e.g. from main.dart
Nylo.use(CustomPlugin());
useErrorStack ({ErrorStackLogLevel level = ErrorStackLogLevel.verbose , Widget errorWidget (FlutterErrorDetails errorDetails )? })
→ dynamic
Use ErrorStack
level
is the log level for ErrorStack
errorWidget
is a custom error widget
Static Properties
instance
→ Nylo
Get Nylo from Backpack
no setter
Static Methods
addRouteHistory (Route route )
→ dynamic
Add a route to the route history.
apiDecoders ()
→ Map <Type , NyApiService >
Get api decoders
appFirstLaunchDate ()
→ Future <DateTime ? >
Days since first launch
appLaunchCount ()
→ Future <int ? >
App launch count - this method will return the app launch count.
appLaunched ()
→ Future <void >
App launched - this method will increment the app launch count.
appLoader ()
→ Widget
Get appLoader
appLogo ()
→ Widget
Get appLogo
appTotalDaysSinceFirstLaunch ()
→ Future <int >
Days since first launch
canMonitorAppUsage ()
→ dynamic
Check if the app can monitor data
containsRoute (String route )
→ bool
Check if the router contains specific route
containsRoutes (List <String > routes )
→ bool
Check if the router contains specific routes
events ()
→ Map <Type , NyEvent >
Get events
getAppThemes ()
→ List <AppTheme >
Get all app themes
getCurrentRoute ()
→ Route ?
Get current route
getCurrentRouteArguments ()
→ dynamic
Get current route arguments
getCurrentRouteName ()
→ String ?
Get current route name
getLocale ()
→ String
Get the current locale
getPreviousRoute ()
→ Route ?
Get previous route
getPreviousRouteArguments ()
→ dynamic
Get previous route arguments
getPreviousRouteName ()
→ String ?
Get previous route name
getRouteHistory ()
→ List
Get the route history.
init ({Function ? setup , dynamic setupFinished (Nylo nylo )? })
→ Future <Nylo >
Initialize Nylo
isCurrentRoute (String routeName )
→ bool
Check if the current route is routeName
isDebuggingEnabled ()
→ bool
Check if the app is in debug mode
isEnvDeveloping ()
→ bool
Check if the app is in developing
isEnvProduction ()
→ bool
Check if the app is in production
isInitialized ()
→ bool
Check if Nylo is initialized
removeLastRouteHistory ()
→ dynamic
Remove a route from the route history.
removeRouteHistory (Route route )
→ dynamic
Remove a route from the route history.
scheduleOnce (String name , dynamic callback () )
→ dynamic
Schedule something to happen once
scheduleOnceAfterDate (String name , dynamic callback (), {required DateTime date })
→ dynamic
Schedule something to happen once after a date
scheduleOnceDaily (String name , dynamic callback (), {DateTime ? endAt })
→ dynamic
Schedule something to happen once daily
updateRouteStack (List <String > routes , {bool replace = true , bool deepLink = false , Map <String , dynamic > ? dataForRoute })
→ dynamic
Update the stack on the router.
routes
is a list of routes to navigate to. E.g. HomePage.path, SettingPage.path
replace
is a boolean that determines if the current route should be replaced.
dataForRoute
is a map of data to pass to the route. E.g. {HomePage.path: {"name": "John Doe"}}
Example:
wipeAllStorageData ()
→ Future <void >
Wipe all storage data