helpers/helper
library
Classes
Model
Nylo's Model class
NyAction
Nylo's NyAction class
NyAppUsage
Nylo's NyAppUsage class
This class is used to monitor app usage.
NyLogger
Logger used for messages you want to print to the console.
NyScheduler
Nylo's Scheduler class
This class is used to schedule tasks to run at a later time.
NyStorage
Base class to help manage local storage
StateAction
StateAction class
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.
Functions
api <T extends NyApiService > (dynamic request (T request ), {BuildContext ? context , String ? bearerToken , String ? baseUrl , int ? page , String ? queryNamePage , String ? queryNamePerPage , int ? perPage , int ? retry , Duration ? retryDelay , bool retryIf (DioException dioException )?, List <Type > events = const [] })
→ dynamic
api helper
Example:
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 })
→ dynamic
Dump a message to the console.
Example:
event <T > ({Map ? data })
→ dynamic
Event helper for Nylo
Example:
getAppTextTheme (TextStyle appThemeFont , TextTheme textTheme )
→ TextTheme
Returns a text theme for a app font.
Returns a TextTheme .
getEnv (String key , {dynamic defaultValue })
→ dynamic
Returns a value from the .env file
the key
must exist as a string value e.g. APP_NAME.
getImageAsset (String imageName )
→ String
Returns the full image path for a image in /public/assets/images/ directory.
Provide the name of the image, using imageName
parameter.
getPublicAsset (String asset )
→ String
Returns the full path for an asset in /public/assets directory.
Usage e.g. getPublicAsset('videos/welcome.mp4');
loadJson <T > (String fileName , {bool cache = true })
→ Future <T? >
Load a json file from the assets folder.
match <T > (dynamic value , Map <String , dynamic > values (), {dynamic defaultValue })
→ T?
Match a value from a Map of data.
It will return null if a match is not found.
now ()
→ DateTime
Get the DateTime.now() value.
nyApi <T > ({required dynamic request (T ), Map <Type , dynamic > apiDecoders = const {} , BuildContext ? context , String ? bearerToken , String ? baseUrl , int ? page , int ? perPage , String queryParamPage = "page" , String ? queryParamPerPage , int ? retry = 0 , Duration ? retryDelay , bool retryIf (DioException dioException )?, List <Type > events = const [] })
→ Future
API helper
nyColorStyle <T > (BuildContext context , {String ? themeId })
→ T
Helper to get the color styles
Find a color style from the Nylo's appThemes
.
nyEvent <T > ({Map ? params , Map <Type , NyEvent > events = const {} })
→ dynamic
Event helper
nyHexColor (String hexColor )
→ Color
Hex Color
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.
sleep (int seconds )
→ dynamic
Sleep for a given amount of milliseconds.
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 > (String 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
.