helpers/ny_helpers
        library 
 
      
    
    
    
    
    
    
    
      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)?, dynamic onSuccess(Response response, dynamic data)?, dynamic onError(DioException dioException)?, Duration? cacheDuration, String? cacheKey, List<Type> events = const []})
    → Future
  
  
- 
  api helper
Example:
  
- 
  authAuthenticate({dynamic data})
    → Future<void>
  
  
- 
  Authenticate user
  
- 
  authData({String? key})
    → dynamic
  
  
- 
  Get the user data
  
- 
  authDeviceId()
    → Future<String?>
  
  
- 
  Get the device id
  
- 
  authIsAuthenticated()
    → Future<bool>
  
  
- 
  Check if the user is authenticated
  
- 
  authKey()
    → String
  
  
- 
  Get the auth key
  
- 
  authLogout()
    → Future<void>
  
  
- 
  Logout user
  
- 
  authSyncToBackpack()
    → Future<void>
  
  
- 
  Sync the auth user data to the backpack
  
- 
  authUpdate(dynamic update(dynamic data))
    → Future<void>
  
  
- 
  Update the auth user data
  
- 
  backpackDelete(String key)
    → void
  
  
- 
  Delete a value using a key.
- 
  backpackDeleteAll()
    → void
  
  
- 
  Delete all values from Backpack.
  
- 
  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 keyandvalue.
- 
  cache()
    → NyCache
  
  
- 
  Get the cache instance
  
- 
  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:
  
- 
  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 keymust exist as a string value e.g. APP_NAME.
- 
  getImageAsset(String imageName)
    → String
  
  
- 
  Returns the full image path for a image in /public/images/ directory.
Provide the name of the image, using imageNameparameter.
- 
  getPublicAsset(String asset)
    → String
  
  
- 
  Returns the full path for an asset in /public 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<dynamic, T> 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)?, dynamic onSuccess(Response response, dynamic data)?, dynamic onError(DioException dioException)?, Duration? cacheDuration, String? cacheKey, 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 {}, bool? broadcast})
    → Future<void>
  
  
- 
  Event helper
  
- 
  nyHexColor(String hexColor)
    → Color
  
  
- 
  Hex Color
  
- 
  printDebug(dynamic message, {bool alwaysPrint = false})
    → void
  
  
- 
  Print a message to the console.
Log level: Debug
  
- 
  printError(dynamic message, {bool alwaysPrint = false})
    → void
  
  
- 
  Print a message to the console.
Log level: Error
  
- 
  printInfo(dynamic message, {bool alwaysPrint = false})
    → void
  
  
- 
  Print a message to the console.
Log level: Info
  
- 
  session(String name, [Map<String, dynamic> items = const {}])
    → NySession
  
  
- 
  Create a new session
  
- 
  setBadgeNumber(int number)
    → Future<void>
  
  
- 
  Set badge number
  
- 
  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, [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 stateand theactionyou want to send.
- 
  trans(String key, {Map<String, String>? arguments})
    → String
  
  
- 
  Returns the translation value from the keyyou 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 nameof the state and then return a value in the callbacksetValue.