ny_core
library
Classes
AlertTab
AlertTab is a class that holds the state, icon, initialCount, backgroundColor, textColor, smallSize, largeSize, textStyle, padding, alignment, offset, and isLabelVisible of an alert tab.
AndroidNotificationConfig
Configuration options specific to Android notifications.
AnimatedButtonWrapper
A wrapper widget that applies animation effects to buttons.
Wraps the button output rather than modifying individual button implementations.
AnimatedButtonWrapperState
ApiCallInfo
Public info about an API call for assertions.
AppBarColors
Color configuration for the app bar.
ArgumentsWrapper
Auth
Authentication class for managing user sessions.
Backpack
Backpack class for storing data
This class is not designed to store huge amounts of data.
BadgeTab
BadgeTab is a class that holds the state, icon, initialCount, backgroundColor, textColor, smallSize, largeSize, textStyle, padding, alignment, offset, and isLabelVisible of a badge tab.
BaseController
Nylo's base controller class
BaseThemeConfig <T >
Base theme config is used for theme management.
Set the required parameters to create new themes.
BootConfig
Configuration for bootstrapping a Nylo application.
BottomModalSheetStyle
BottomModalSheetStyle
BottomNavStyle
Style configuration for bottom navigation bar
BottomTabBarColors
Color configuration for the bottom tab bar.
ButtonAnimationStyle
ButtonAnimationStyle defines composable animation styles for buttons.
Use factory constructors to create different animation effects.
ButtonSplashStyle
ButtonSplashStyle defines customizable splash effects for buttons.
Use factory constructors to create different splash styles.
ButtonState
ButtonState is a stateful widget that manages the state of a button.
CollectionItem <T >
Wrapper class containing item data and position helpers.
CollectionView <T >
The CollectionView widget is a wrapper for the ListView widget.
It provides a simple way to display a list of items with full type safety.
ConditionalGuard
Conditionally apply a guard based on a predicate.
Connective
A widget that rebuilds based on connectivity state.
CurrencyInputMatcher
Currency input matcher
CurrencyMeta
Currency meta data
DecoratorTextField
DecoratorTextField is a class that helps in managing form text fields
DefaultResponse <T >
Base class used to handle networking responses
DefaultToastNotification
DefaultToastNotification a simple toast notification.
This is the fallback widget used when no custom toast styles are registered.
DioApiService
Base API Service class
FactoryDefinition <T >
Factory definition container.
FactoryDefinitionWithOverrides <T >
Factory definition with overrides support.
FactoryState <T >
Factory state modifier container.
FadeOverlay
A widget that applies a gradient fade effect over its child.
Field
Represents a form field with configuration, validation, and state management capabilities.
FieldBaseState <T extends StatefulWidget >
Abstract base class for form field widget states.
FieldStyle
Base class for defining styling options for form fields.
FieldStyleCheckbox
Style configuration for checkbox fields.
FieldStyleChip
Style configuration for chip-based selection fields.
FieldStyleDateTimePicker
Style configuration for date and time picker fields.
FieldStylePicker
FieldStylePicker is used to define the style for a picker field.
FieldStyleRadio
Style configuration for radio button fields.
FieldStyleRangeSlider
Style configuration for range slider fields.
FieldStyleSlider
Style configuration for slider fields.
FieldStyleSwitchBox
FieldStyleSwitchBox is used to define the style for a switch box field.
FieldStyleTextField
Comprehensive style configuration for text input fields.
FilterArgs
Filter arguments for NetworkLogger.filter
FormCheckboxStateActions
Provides state management actions for NyFormCheckbox widgets.
FormChipStateActions
Provides state management actions for NyFormChip widgets.
FormCollection
A collection of form options that can be used with various form field widgets.
FormDateTimePickerStateActions
State actions for the NyFormDateTimePicker widget
FormOption
Represents a single option item for form components like dropdowns, radios, and chips.
FormPickerStateActions
Provides state management actions for NyFormPicker widgets.
FormRadioStateActions
Provides state management actions for NyFormRadio widgets.
FormRangeSliderStateActions
Provides state management actions for NyFormRangeSlider widgets.
FormRule
Base class for all form validation rules.
FormRuleBeginsWith
FormRuleBooleanFalse
FormRuleBooleanTrue
FormRuleCapitalized
FormRuleContains
FormRuleCustom
FormRuleDate
FormRuleDateAgeIsOlder
FormRuleDateAgeIsYounger
FormRuleDateInFuture
FormRuleDateInPast
FormRuleEmail
FormRuleEndsWith
FormRuleEquals
FormRuleEquals
This rule checks if the input data is equal to a specified data source.
FormRuleLowercase
FormRuleMaxLength
FormRuleMaxSize
FormRuleMaxValue
FormRuleMinLength
FormRuleMinSize
FormRuleMinValue
FormRuleNotEmpty
FormRuleNumeric
FormRulePassword
FormRulePhoneNumberUk
FormRulePhoneNumberUs
FormRulePostcodeUk
FormRuleRegex
FormRuleUppercase
FormRuleUrl
FormRuleZipcodeUs
FormSliderStateActions
Provides state management actions for NyFormSlider widgets.
FormStateActions
The base class for form state actions
This class is used to manage the state of the form fields
FormSwitchBoxStateActions
Provides state management actions for NyFormSwitchBox widgets.
FormTextFieldStateActions
Provides state management actions for NyFormTextField widgets.
FormValidationError
Represents a validation failure response.
FormValidationResponse
Represents the response of a form validation process.
This class is used to encapsulate the result of a validation check,
indicating whether the form is valid or not, along with an optional message.
FormValidationResult
FormValidationSuccess
Represents a successful validation response
FormValidator
FutureWidget <T >
Simple way to render Future's in your project.
GeneralColors
General color configuration for the app.
GuardStack
Compose multiple guards into a single guard.
InputField
Nylo's Text Field Widget
IOSNotificationConfig
Configuration options specific to iOS notifications.
JourneyButtonStyle
Base class for defining the style and parameters of journey buttons.
JourneyButtonStyles:
JourneyCircularProgress
A circular progress indicator for journeys
JourneyContent
A reusable content widget for journey pages
JourneyDotProgress
A dot-based progress indicator for journeys
JourneyNumberedProgress
A numbered step progress indicator for journeys
JourneyProgressIndicator
Base class for defining the style and parameters of a journey progress indicator.
JourneyProgressIndicators:
JourneyProgressStyle
Comprehensive configuration for journey progress display.
JourneySegmentProgress
A segmented progress bar for journeys
JourneyState <T extends StatefulWidget >
A specialized state class for journey pages in NavigationHub journey layouts
JourneyTimelineProgress
A timeline-style progress indicator for journeys
JsonHelper
Json helper class
LanguageSwitcher
LanguageSwitcher is a widget that allows you to switch languages in your app.
You can use it in the AppBar or as a bottom sheet modal using the showBottomModal method.
Example:
LoadingStyle
The LoadingStyle class is used to determine the type of loading widget
LocalNotification
A class for creating and sending local notifications on iOS and Android.
MockApiRequest
Represents a mock API request.
MockResponse
Represents a mock API response.
Model <T >
Nylo's Model class
NavBarData
Data passed to custom nav bar builders
NavigationHub <T extends StatefulWidget >
NavigationHubLayout
NavigationHubStateActions
Navigation hub state actions
NavigationTab
NavigationTab is a class that holds the title, page, icon, activeIcon, backgroundColor, tooltip, and meta data of a bottom navigation tab.
NetworkLogger
A network logger interceptor for Dio
Provides pretty-printed request/response logging with:
NotificationAttachment
Represents an attachment for a notification.
NyAction
Nylo's NyAction class
NyApiService
NyApp
A unified widget that combines theme management and localization.
NyAppUsage
Nylo's NyAppUsage class
This class is used to monitor app usage.
NyArgument
Nylo Route Argument
Contains the data passed from another route.
NyBaseModal
NyBaseModal
NyBaseState <T extends StatefulWidget >
NyCache
Cache helper
NyColor
Helper to find correct color from the context.
NyColorStyleBuilder <T >
A widget that rebuilds with typed color styles when the theme changes.
NyConnectivity
Connectivity helper for checking network status.
NyController
Base NyController
NyEnv
Base class for environment configuration.
NyEnvRegistry
Registry for the user's generated Env class.
NyEvent
Base interface for Events
NyEventBus
NyEventCallbackListener
NyEventSubscription <T extends NyEvent >
Subscription handle that can be used to cancel listening
NyFactory
Laravel-style model factories for testing.
NyFaker
Faker class for generating random test data.
NyFieldStatefulWidget
A stateful widget base class for creating form field widgets.
NyFormActions
Helper class for dispatching form actions by name.
NyFormCheckbox
A checkbox widget for forms that allows users to toggle a boolean value.
NyFormChip
A customizable chip selection widget for forms that allows users to select multiple options.
NyFormData
Base class for defining form structure, data, and behavior in Nylo applications.
NyFormDateTimePicker
A NyFormDateTimePicker widget for Form Fields
NyFormPicker
A dropdown/picker selection widget for forms that allows users to choose from a list of options.
NyFormRadio
A radio button group widget for forms that allows users to select a single option.
NyFormRangeSlider
A range slider widget for forms that allows users to select a range of values.
NyFormSlider
A slider widget for forms that allows users to select a value from a range.
NyFormSwitchBox
A switch toggle widget for forms that allows users to toggle a boolean value.
NyFormTextField
A text input field widget designed for use within forms.
NyFormWidget
NyFormWidget is an abstract StatefulWidget for building forms declaratively.
NyListener
Base class for listeners
Nylo
NyLocaleHelper
Helper class for locale-related operations.
NyLocalization
NyLocalization
Singleton object that handles localization in Nylo
NyLocalizationConfig
Configuration class for NyLocalization.
NyLogEntry
Represents a single log entry with metadata.
NyLogger
Logger used for messages you want to print to the console.
NyMockApi
API mocking utilities for testing.
NyMockChannels
Auto-mocking for common Flutter platform channels used in Nylo.
NyMockRouteGuard
A mock route guard for testing NyPage route guard behavior.
NyModalLayout
NyModalLayout
NyNavigator
The NyNavigator class is a singleton class that manages the routing of the
application. It is a thin layer on top of Navigator to help you encapsulate
and manage routing at one place.
NyPage <T extends StatefulWidget >
NyProvider
Base class for Providers.
NyQueryParameters
Nylo Query Parameters
Contains the data passed from the URL.
E.g. "/home-page?userId=2
data = {"userId": "2"}
NyRequest
Base class to handle requests
NyResponse <T >
Enhanced API Response class that provides access to the full Dio Response
along with morphed data and useful response utilities
NyRouteGuard
Base class for Nylo route guards.
NyRouteHistoryObserver
A NavigatorObserver that keeps track of the current route.
NyRouter
NyRouterRoute manages routing, registering routes with transitions, navigating to
routes, closing routes. It is a thin layer on top of Navigator to help
you encapsulate and manage routing at one place.
NyRouterOptions
Options to configure a Nylo Router instance.
NyRouterRoute
The NyRouterRoute class is used to define a route in the Nylo Router.
NyScheduler
Nylo's Scheduler class
This class is used to schedule tasks to run at a later time.
NySession
NyState <T extends StatefulWidget >
NyStatefulWidget <T extends BaseController >
StatefulWidget's include a BaseController to access from your child state.
NyStateTestHelpers
Helpers for testing EventBus-driven state management in NyPage and NyState.
NyStorage
Base class to help manage local storage
NyTest
Main testing orchestrator for Nylo testing framework.
NyTestCache
In-memory cache implementation for testing.
NyThemeBuilder
A widget that rebuilds when the theme changes.
NyThemeManager
Singleton class to manage app themes.
NyThemeProvider
Widget that provides theme context to its descendants.
NyThemeStorage
Storage service for theme persistence.
NyTime
NyTime - Time manipulation utilities for testing.
NyToastRecorder
A simple recorder that tracks toast notifications shown during tests.
NyWidgetTest
Widget testing utilities for Nylo applications.
OfflineBanner
Widget that shows an offline banner at the top of the screen.
PageNotFound
Legacy page request class for backward compatibility.
PageTransition <T >
A flexible page transition class that extends PageRouteBuilder to provide
a variety of customizable transition animations between screens.
PageTransitionSettings
This class contains all page transition settings.
ParameterizedGuard <P >
A route guard that accepts configuration parameters.
Pullable
The Pullable widget helps you refresh and load more content with a flexible API.
PullableConfig
Configuration for the Pullable widget
RedirectConfig
Configuration for a redirect action.
RouteContext <T >
Immutable context passed to route guards.
RouteData
Route data class for navigation configuration.
RouteGuard
@deprecated Use NyRouteGuard instead.
Legacy class interface for backward compatibility.
RouteMatch
Represents a matched route with its parameters.
RouteMatcher
The RouteMatcher class is used to match the route with the registered routes.
Spacing
A utility widget that creates consistent spacing between UI elements.
StateAction
StateAction class
StateActions
State actions
StorageConfig
Storage configuration for Nylo.
You can set the storage options for each platform.
E.g. AndroidOptions, IOSOptions, LinuxOptions, WindowsOptions, WebOptions, MacOsOptions
StorageManager
Storage manager for Nylo.
StyledText
StyledText allows you to display rich text with different styles.
TextFieldStateActions
Provides state management actions for InputField widgets.
TextTr
A Text widget that automatically translates its content using Nylo's
localization system.
ThemeColor
Base color configuration for app themes.
ToastAnimation
ToastAnimation defines animation styles for toast notifications.
Use factory constructors to create different animation effects.
ToastMeta
Toast Meta makes it easy to use pre-defined styles in the toast alert.
ToastNotificationRegistry
Registry for toast notification styles.
Stores widget factories keyed by string IDs (e.g., "success", "warning").
Use ToastNotificationRegistry.register to add custom toast styles.
ToastRecord
A recorded toast notification entry.
TransitionType
A utility class that simplifies the creation of page transitions by encapsulating
transition types and their associated settings.
UpdateState
UpdateState Model.
Functions
api <T extends NyApiService > (dynamic request (T request ), {String ? bearerToken , String ? baseUrl , int ? page , String ? queryNamePage , String ? queryNamePerPage , int ? perPage , int retry = 0 , Duration ? retryDelay , bool retryIf (DioException dioException )?, dynamic onSuccess (Response response , dynamic data )?, dynamic onError (DioException dioException )?, Duration ? cacheDuration , String ? cacheKey , List <Type > events = const [] })
→ Future
api helper
Example:
apiWasCalled (String endpoint , {String ? method , int ? times })
→ Matcher
Custom matcher for API calls.
authAuthenticate ({dynamic data , String ? session })
→ Future <void >
Authenticate a session.
authData ({String ? field , String ? session })
→ dynamic
Get auth data for a session.
authDeviceId ()
→ Future <String >
Get the device ID.
authIsAuthenticated ({String ? session })
→ Future <bool >
Check if a session is authenticated.
authKey ([String ? session ])
→ String
Get the storage key for a session.
authLogout ({String ? session })
→ Future <void >
Logout from a session.
authLogoutAll ({List <String > sessions = const [] })
→ Future <void >
Logout from all sessions.
authSet (dynamic update (dynamic data ), {String ? session })
→ Future <void >
Update auth data for a session.
authSyncToBackpack ({String ? session })
→ Future <void >
Sync auth data to backpack for a session.
backpackDelete (String key )
→ void
Delete a value using a key.
backpackDeleteAll ()
→ void
Delete all values from Backpack .
backpackHas (String key , {dynamic value })
→ Matcher
Custom matcher for Backpack containing key.
backpackNylo ({String key = 'nylo' })
→ Nylo
Returns an instance of Nylo.
backpackRead <T > (String key , {dynamic defaultValue })
→ T?
Read data from the Backpack with a key.
backpackSave (String key , dynamic value )
→ void
Save a value using a key and value.
bootFinished (Nylo nylo , Map <Type , NyProvider > providers , {String key = "nylo" , bool ? enableDebugLogging , bool throwOnError = false })
→ Future <Nylo >
Called after Nylo finishes setup.
cache ()
→ NyCache
Get the cache instance.
Throws StateError if cache is not initialized.
canOpenUrl (String url )
→ Future <bool >
Check if a URL can be opened.
clearBadgeNumber ()
→ Future <void >
Clear badge number
dataToModel <T > ({required dynamic data , Map <Type , dynamic > ? modelDecoders })
→ T
Return an object from your modelDecoders using data.
dump (dynamic value , {String ? tag , bool alwaysPrint = false })
→ void
Dump a message to the console.
Example:
event <T > ({Map ? data , bool ? broadcast })
→ Future
Event helper for Nylo
Example:
expectApiCalled (String endpoint , {String ? method , int ? times })
→ void
Assert that an API endpoint was called.
expectApiNotCalled (String endpoint , {String ? method })
→ void
Assert that an API endpoint was not called.
expectAuthenticated <T > ()
→ void
Assert that a user is authenticated.
expectBackpackContains (String key , {dynamic value })
→ void
Assert that Backpack contains a specific key.
expectBackpackNotContains (String key )
→ void
Assert that Backpack does not contain a specific key.
expectDebugMode ()
→ void
Assert that Nylo is in debug mode.
expectDevelopingMode ()
→ void
Assert that Nylo is in developing mode.
expectEnv (String key , dynamic expectedValue )
→ void
Assert that an environment variable has a specific value.
expectEnvSet (String key )
→ void
Assert that an environment variable is set (not null).
expectGuest ()
→ void
Assert that no user is authenticated (guest).
expectLoadingNamed (WidgetTester tester , Finder finder , String name )
→ void
Assert that a named loading key is active in a NyPage/NyState widget.
expectLocale (String locale )
→ void
Assert that the current locale matches.
expectLocked (WidgetTester tester , Finder finder , String name )
→ void
Assert that a named lock is currently held in a NyPage/NyState widget.
expectNotLoadingNamed (WidgetTester tester , Finder finder , String name )
→ void
Assert that a named loading key is not active in a NyPage/NyState widget.
expectNotLocked (WidgetTester tester , Finder finder , String name )
→ void
Assert that a named lock is not held in a NyPage/NyState widget.
expectNoToastShown ({String ? id , String ? description })
→ void
Assert that no toast notification was shown matching the criteria.
expectNotRoute (String route )
→ void
Assert that the current route is not the specified route.
expectNyloInitialized ()
→ void
Assert that Nylo is initialized.
expectProductionMode ()
→ void
Assert that Nylo is in production mode.
expectRoute (String route )
→ void
Test helper utilities for Nylo testing.
expectRouteExists (String route )
→ void
Assert that a route exists in the router.
expectRouteInHistory (String route )
→ void
Assert that the route history contains a specific route.
expectRoutesExist (List <String > routes )
→ void
Assert that routes exist in the router.
expectStateAction (String stateName , String action , {int ? times })
→ void
Assert that a state action was fired to the given stateName.
expectStateData (WidgetTester tester , Finder finder , dynamic matcher )
→ void
Assert the stateData of a NyPage or NyState widget.
expectStateUpdated (String stateName , {int ? times })
→ void
Assert that a state update was fired to the given stateName.
expectTestMode ()
→ void
Assert that Nylo is in test mode.
expectToastShown ({String ? id , String ? description })
→ void
Assert that a toast notification was shown.
fireStateAction (String stateName , String action , {dynamic data })
→ void
Fire a state action to a widget identified by stateName.
fireStateUpdate (String stateName , {dynamic data })
→ void
Fire an UpdateState event to a widget identified by stateName.
getAppTextTheme (TextStyle appThemeFont , TextTheme textTheme )
→ TextTheme
Returns a text theme for a app font.
Returns a TextTheme .
getAsset (String asset )
→ String
Returns the full path for an asset in /assets directory.
Usage e.g. getAsset('videos/welcome.mp4');
getEnv (String key , {dynamic defaultValue })
→ dynamic
Returns a value from the generated env.g.dart file.
The key must exist as a string value e.g. APP_NAME.
getImageAsset (String imageName , {String ? path = '/images' })
→ String
Returns the full image path for a image in /assets/images/ directory.
Provide the name of the image, using imageName parameter.
hasRouteName (String name )
→ Matcher
Custom matcher for route name.
isDouble (String ? s )
→ bool
Checks if the value is a double (must contain a decimal point).
Returns false for integers - use isInteger to check for integers first.
isInteger (String ? s )
→ bool
Checks if the value is an integer.
isType <T > ()
→ TypeMatcher <T >
Matcher for checking if an object is of a specific type.
listenOn <E extends NyEvent > (dynamic callback (Map ? data ) )
→ NyEventSubscription <NyEvent >
loadJson <T > (String fileName , {bool cache = true })
→ Future <T? >
Load a json file from the assets folder.
localNotification (String title , String body )
→ LocalNotification
Creates a new LocalNotification with the given title and body.
match <T > (dynamic value , Map <dynamic , T > values (), {T? defaultValue })
→ T
Match a value from a Map of data.
Returns defaultValue if no match is found, or throws if no default provided.
now ()
→ DateTime
Get the DateTime.now() value.
nyApi <T > ({required dynamic request (T ), Map <Type , dynamic > apiDecoders = const {} , String ? bearerToken , String ? baseUrl , int ? page , int ? perPage , String queryParamPage = "page" , String ? queryParamPerPage , int retry = 0 , Duration ? retryDelay , bool retryIf (DioException dioException )?, dynamic onSuccess (Response response , dynamic data )?, dynamic onError (DioException dioException )?, Duration ? cacheDuration , String ? cacheKey , List <Type > events = const [] })
→ Future
API helper
nyCi (String description , Future <void > callback () )
→ void
Run a test only in CI environment.
nyColorStyle <T > (BuildContext context , {String ? themeId })
→ T
Helper to get the color styles
Find a color style from the Nylo's appThemes.
nyColorStyles <T > ()
→ T
Helper function to get color styles from NyThemeManager .
nyEvent <T > ({Map ? params , Map <Type , NyEvent > events = const {} , bool ? broadcast })
→ Future <void >
Event helper
nyFailing (String description , Future <void > callback () )
→ void
Mark a test as expected to fail.
nyGroup (String description , void callback () )
→ void
Pest-style group wrapper.
nyHexColor (String hexColor )
→ Color
Hex Color
nyRoutes (dynamic build (NyRouter router ) )
→ NyRouter
Builds the routes in the router.dart file
nySetUp (void callback () )
→ void
Execute a callback before each test in the current group.
nySetUpAll (void callback () )
→ void
Execute a callback once before all tests in the current group.
nySkip (String description , Future <void > callback (), String reason )
→ void
Skip a test with a reason.
nyTearDown (void callback () )
→ void
Execute a callback after each test in the current group.
nyTearDownAll (void callback () )
→ void
Execute a callback once after all tests in the current group.
nyTest (String description , Future <void > callback (), {bool skip = false , dynamic tags , Timeout ? timeout })
→ void
Pest-style test wrapper for Nylo tests.
nyWidgetTest (String description , Future <void > callback (WidgetTester tester ), {bool skip = false , dynamic tags , Timeout ? timeout })
→ void
Pest-style widget test wrapper with Patrol integration.
objectToJson (dynamic object )
→ Map <String , dynamic > ?
Attempts to call toJson() on an object.
openUrl (String url , {UrlLaunchModeType mode = UrlLaunchModeType.externalApplication , bool webOnly = false , })
→ Future <bool >
Opens a URL in the browser.
printAlert (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Alert
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printDebug (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Debug
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printEmergency (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Emergency (highest severity)
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printError (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Error
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printInfo (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Info
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printJson (dynamic message , {bool alwaysPrint = false })
→ void
Print a message to the console as JSON.
printSuccess (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Success
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printVerbose (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Verbose
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
printWarning (dynamic message , {Map <String , dynamic > ? context , bool alwaysPrint = false })
→ void
Print a message to the console.
Log level: Warning
Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.
pushNotification (String title , String body )
→ LocalNotification
Creates a new LocalNotification with the given title and body.
routeIf (bool condition , dynamic routeName , {dynamic data , Map <String , dynamic > ? queryParameters , NavigationType navigationType = NavigationType.push , dynamic result , bool removeUntilPredicate (Route route )?, TransitionType ? transitionType , PageTransitionType ? pageTransitionType , PageTransitionSettings ? pageTransitionSettings , dynamic onPop (dynamic value )? })
→ Future <void >
Navigate to a new route if a condition is met.
If the condition is false, the route will not be navigated to.
routeTo (dynamic routeName , {dynamic data , Map <String , dynamic > ? queryParameters , NavigationType navigationType = NavigationType.push , dynamic result , bool removeUntilPredicate (Route route )?, TransitionType ? transitionType , PageTransitionType ? pageTransitionType , PageTransitionSettings ? pageTransitionSettings , int ? tabIndex , dynamic onPop (dynamic value )? })
→ Future <void >
Navigate to a new route.
routeToAuthenticatedRoute ({dynamic data , NavigationType navigationType = NavigationType.pushAndForgetAll , dynamic result , bool removeUntilPredicate (Route route )?, TransitionType ? transitionType , PageTransitionType ? pageTransitionType , PageTransitionSettings ? pageTransitionSettings , dynamic onPop (dynamic value )? })
→ Future <void >
Navigate to the auth route.
routeToInitial ({dynamic data , NavigationType navigationType = NavigationType.pushAndForgetAll , dynamic result , bool removeUntilPredicate (Route route )?, TransitionType ? transitionType , PageTransitionType ? pageTransitionType , PageTransitionSettings ? pageTransitionSettings , dynamic onPop (dynamic value )? })
→ Future <void >
Navigate to the initial route.
session (String name , [Map <String , dynamic > items = const {} ])
→ NySession
Create a new session
setBadgeNumber (int number )
→ Future <void >
Set badge number
setupApplication (Map <Type , NyProvider > providers , {bool ? enableDebugLogging })
→ Future <Nylo >
Sets up application providers.
showNextLog ()
→ void
If you call showNextLog it will force the app to display the next
'NyLogger' log even if your app's APP_DEBUG is set to false.
showToastNotification (BuildContext context , {String id = 'success' , String ? title , String ? description , Duration ? duration , ToastNotificationPosition ? position , ToastAnimation ? animation , VoidCallback ? action , VoidCallback ? onDismiss , VoidCallback ? onShow })
→ void
Display a new Toast notification to the user.
Provide a valid toast id (e.g., "success", "warning", "info", "danger")
or a custom ID registered via Nylo.addToastNotifications .
Set a title and description to personalize the message.
sleep (int seconds , [int microseconds = 0 ])
→ Future <void >
Delays execution for the specified duration.
stateAction (String action , {required dynamic state , dynamic data })
→ void
Send a state action to a NyState or NyPage in your application.
Provide the state and the action you want to send.
storageCollectionDeleteIndex <T > (String key , int index )
→ Future <void >
Delete an item from a collection in the storage class.
storageCollectionDeleteValue <T > (String key , {required T value })
→ Future <void >
Delete a value from a collection in the storage class.
storageCollectionDeleteWhere <T > (String key , bool value (T where ) )
→ Future <void >
Delete an item from a collection in the storage class.
storageCollectionRead <T > (String key , {Map <Type , dynamic > ? modelDecoders })
→ Future <List <T > >
Read a collection from the storage class.
storageCollectionSave <T > (String key , List <T > collection )
→ Future <void >
Save a collection to the storage class.
storageDelete (String key )
→ Future <void >
Delete data from the storage class.
storageDeleteMultiple (List <String > keys , {bool andFromBackpack = false })
→ Future <void >
Delete multiple keys from storage in batch.
storageGetTTL (String key )
→ Future <Duration ? >
Get the remaining time-to-live for a key with expiry.
storageHasKey (String key )
→ Future <bool >
Check if a key exists in storage.
storageRead <T > (String key , {Map <Type , dynamic > ? modelDecoders })
→ Future <T? >
Read data from the storage class.
Returns the value cast to type T, or null if not found.
storageReadMultiple <T > (List <String > keys , {Map <Type , dynamic > ? modelDecoders })
→ Future <Map <String , T? > >
Read multiple keys from storage in batch.
storageReadWithExpiry <T > (String key , {T? defaultValue , Map <Type , dynamic > ? modelDecoders , bool deleteIfExpired = true })
→ Future <T? >
Read data from the storage class, respecting TTL expiration.
storageRemoveExpired ()
→ Future <int >
Remove all expired keys from storage.
storageSave (String key , dynamic object , {bool inBackpack = false })
→ Future <void >
Save data to the storage class.
storageSaveAll (Map <String , dynamic > items , {bool inBackpack = false })
→ Future <void >
Save multiple key-value pairs to storage in batch.
storageSaveWithExpiry (String key , dynamic object , {required Duration ttl , bool inBackpack = false })
→ Future <void >
Save data to the storage class with an expiration time.
testNyPage (String description , {required Widget build (), required Future <void > expectations (WidgetTester tester ), bool useSimpleTheme = true , Duration initTimeout = const Duration(seconds: 10) , bool skip = false })
→ void
Test a NyStatefulWidget page with common assertions.
testNyPageLoading (String description , {required Widget build (), bool skip = false })
→ void
Test a NyStatefulWidget's loading state.
trans (String key , {Map <String , String > ? arguments })
→ String
Returns the translation value from the key you provide.
E.g. trans("hello")
lang translation will be returned for the app locale.
updateState <T > (dynamic name , {dynamic data , dynamic setValue (T? currentValue )? })
→ void
Update's the state of a NyState Widget in your application.
Provide the name of the state and then return a value in the callback setValue.
Typedefs
ChildBuilder
= Widget Function(BuildContext context )
Builder function type for creating child widget
CollectionItemBuilder <T >
= Widget Function(BuildContext context , CollectionItem <T > item )
Type-safe builder function signature.
CustomAnimationBuilder
= Widget Function(BuildContext context , AnimationController controller , Duration duration , Widget child )
Builder method for custom animation.
EnvContainsKey
= bool Function(String key )
Type definition for the env containsKey function.
EnvGetter
= dynamic Function(String key , {dynamic defaultValue })
Type definition for the env getter function.
FormValidationResponseBag
= List <FormValidationResult >
MockApiHandler
= Future Function(MockApiRequest request )
Handler function type for mock API responses.
ModalShowFunction
= Future <T? > Function<T >(BuildContext context , {List <Widget > actionsColumn , List <Widget > actionsRow , Color ? backgroundColor , required Widget child , Color ? closeButtonColor , Color ? closeButtonIconColor , Color ? handleColor , double ? height , bool isScrollControlled , Color ? modalBackgroundColor , BoxDecoration ? modalDecoration , bool showCloseButton , bool showHandle , bool useRootNavigator , bool useSafeArea })
Type definition for the NyBaseModal.show method.
Use this to preserve type information when creating references to the show method.
NyLogCallback
= void Function(NyLogEntry entry )
Callback type for log listeners.
NyRouterRouteBuilder
= Widget Function(BuildContext context , NyArgument ? args , NyQueryParameters ? queryParameters )
The typedef for the route builder.
NyRouteView
= Widget Function(BuildContext context )
PushNotification
= LocalNotification
Backwards compatibility alias for LocalNotification .
PushNotificationAttachments
= NotificationAttachment
Backwards compatibility alias for NotificationAttachment .
Typedef for RequestHeaders
RouteView
= (String , Widget Function(BuildContext context ) )
Type definition for the route view.
StorageKey
= String
StorageKey typedef
ToastOnInitStateCallback
= dynamic Function(Duration toastDuration , Duration animDuration )
Callback for the toast widget's initState lifecycle hook.
Receives the toast display duration and animation animDuration.
ToastStyleFactory
= Widget Function(ToastMeta meta , void updateMeta (ToastMeta ) )
Typedef for toast style factory function.
The factory receives the ToastMeta and an updateMeta callback
to allow the widget to update position, duration, etc.
TransitionPageBuilder
= Widget Function(BuildContext context , Animation <double > animation , Animation <double > secondaryAnimation )
Builder function type for creating the transition page