playx_localization library

Classes

AndroidOptions
AppleOptions
AssetLoader
abstract class used to building your Custom AssetLoader Example:
Bidi
This provides utility methods for working with bidirectional text. All of the methods are static, and are organized into a class primarily to group them together for documentation and discoverability.
BidiFormatter
Bidi stands for Bi-directional text. According to Wikipedia: Bi-directional text is text containing text in both text directionalities, both right-to-left (RTL) and left-to-right (LTR). It generally involves text containing different types of alphabets, but may also refer to boustrophedon, which is changing text directionality in each row.
Cancelable<R>
DateFormat
DateFormat is for formatting and parsing dates in a locale-sensitive manner.
DefaultAppScrollBehavior
Describes how Scrollable widgets behave for MaterialApps. Defaults to use touch, mouse, and trackpad.
DefaultColoredLoggerFormatter
A default logger formatter that uses colored output for log messages.
Disposable
If objects that are registered inside GetIt implements Disposable the onDispose method will be called whenever that Object is unregistered, reset or its enclosing Scope is popped
Equatable
A base class to facilitate operator == and hashCode overrides.
EquatableConfig
The default configuration for all Equatable instances.
FlutterSecureStorage
Gentle
GetIt
Very simple and easy to use service locator You register your object creation factory or an instance of an object with registerFactory, registerSingleton or registerLazySingleton And retrieve the desired object using get or call your locator as function as its a callable class Additionally GetIt offers asynchronous creation functions as well as functions to synchronize the async initialization of multiple Singletons
InitDependency
Data structure used to identify a dependency by type and instanceName
Intl
The Intl class provides a common entry point for internationalization related tasks. An Intl instance can be created for a particular locale and used to create a date format via anIntl.date(). Static methods on this class are also used in message formatting.
IOSOptions
Specific options for iOS platform.
LinuxOptions
Specific options for Linux platform. Currently there are no specific linux options available.
MacOsOptions
Specific options for macOS platform.
MapUtils
MicroMoney
Used primarily for currency formatting, this number-like class stores millionths of a currency unit, typically as an Int64.
Mixinable<T>
NumberFormat
Provides the ability to format a number in a locale-specific way.
NumberParserBase<R>
ObjectRegistration<T extends Object>
PlayxAsyncPrefs
An abstract class that provides an asynchronous interface for accessing and manipulating SharedPreferences data.
PlayxBaseLogger
Abstract logger interface used by PlayxLogger. Can be implemented with any backend (e.g., Talker, Logger, etc.).
PlayxCore
Core of the playx_core plugin.
PlayxEnv
Wrapper for configure any the application with global variables using a .env file.
PlayxEnvSettings
Settings for PlayxEnvSettings.
PlayxInheritedLocalization
PlayxLocaleConfig
Locale config : used to configure out app locales by providing the app with the supported locales and localization settings. Create a class that extends the PlayxLocaleConfig class to implement your own locales.
PlayxLocalization
PlayxLocalization : Used to update current app locale with id, index, device locale and more. And holds reference to the current app locale. With other utilities to be used. Must be initialized by calling boot before calling any method.
PlayxLocalizationBuilder
PlayxLocalizationBuilder: It allows us to create a widget with current locale. It should rebuild the widget automatically after changing the locale.
PlayxLogger
A centralized static logger utility for Playx-based applications.
PlayxLoggerSettings
Settings for initializing a logger without depending on any implementation.
PlayxPlatform
Utility class for determining the current platform type and characteristics.
PlayxPrefs
Wrapper for handling shared preferences to save and retrieve data.
PlayxPrefsSettings
PlayxPrefsWithCache
Provides a persistent store for simple data with caching capabilities.
PlayxSecurePrefs
Wrapper for handling secure preferences to save and get preferences.
PlayxSecurePrefsSettings
Settings for PlayxSecurePrefsSettings .
RootBundleAssetLoader
default used is RootBundleAssetLoader which uses flutter's assetloader
SendPort
Sends messages to its ReceivePorts.
ShadowChangeHandlers
If an object implements the ShadowChangeHandler if will get notified if an Object with the same registration type and name is registered on a higher scope which will shadow it. It also will get notified if the shadowing object is removed from GetIt
SharedPreferences
Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android), providing a persistent store for simple data.
SharedPreferencesAsync
Provides a persistent store for simple data.
SharedPreferencesOptions
Basic options for creating SharedPreferencesAsync classes.
SharedPreferencesWithCache
Provides a persistent store for simple data.
SharedPreferencesWithCacheOptions
Options necessary to create a SharedPreferencesWithCache.
TalkerPlayxLogger
Task<R>
TaskGentle<R>
TaskGentleWithPort<R>
TaskRegular<R>
TaskWithPort<R>
TextDirection
Represents directionality of text.
WebOptions
Specific options for web platform.
WebUtils
A stubbed version of WebUtils for non-web platforms (e.g. mobile, desktop).
WillSignalReady
If your singleton that you register wants to use the manually signalling of its ready state, it can implement this interface class instead of using the signalsReady parameter of the registration functions (you don't really have to implement much ;-) )
WindowsOptions
Specific options for Windows platform.
WithPort
WorkManagerSettings
XLocale
Defines locales with more information like id and name. These info can be used to change the current locale. display name of the locale and more.

Enums

KeychainAccessibility
KeyChain accessibility attributes as defined here: https://developer.apple.com/documentation/security/ksecattraccessible?language=objc
KeyCipherAlgorithm
Month
ObjectRegistrationType
You will see a rather esoteric looking test (const Object() is! T) at several places. It tests if T is a real type and not Object or dynamic. For each registered factory/singleton an ObjectRegistration<T> is created it holds either the instance of a Singleton or/and the creation functions for creating an instance when get is called
StorageCipherAlgorithm
Weekday
WorkPriority

Mixins

EquatableMixin
A mixin that helps implement equality without needing to explicitly override operator == and hashCode.

Extensions

BoolExtensions on bool
BuildContextLocalizationExtension on BuildContext
ContextColorsExtensions on BuildContext
ContextLocalizationExtensions on BuildContext
  • Localization shortcuts
  • ContextMediaQueryExtensions on BuildContext
  • MediaQuery shortcuts
  • ContextNavigatorExtensions on BuildContext
  • Navigation shortcuts
  • ContextThemeExtensions on BuildContext
    DateExtensions on DateTime
    Extension functions to help operations on DateTime.
    DateTimeExtensions on DateTime
    Extensions for DateTime
    DurationExtensions on Duration
    Extension functions to convert duration to formatted hours, minutes, seconds and milliseconds.
    LocaleExtension on Locale
    LocaleExtensions on Locale
    extensions on the locale
    LocalizationStringExtensions on String
    Extension on String to help with localization and language-specific analysis.
    MapAsync on T
    NestedIterablesExtensions on Iterable<Iterable<T>>
    NumExtensions on num
    Extension functions to help perform common operations and formatting on num values.
    PlayxColorExtensions on Color
    PlayxIterableExtensions on Iterable<T>
    Extensions on Iterable class to make it easier to work with.
    PlayxLocalizationStringExtensions on String
    Strings extension method for access to tr and plural() Example :
    StringExtensions on String
    Extension function on string.
    TextTranslateExtension on Text
    Text widget extension method for access to tr() and plural() Example :
    XLocaleExtension on XLocale

    Properties

    getIt GetIt
    Returns the instance of GetIt used by the playx_core plugin.
    no setter
    workerManager → _Executor
    final

    Functions

    asBool(dynamic json, String key) bool
    Returns a bool for the value at key. Throws a FormatException if the value cannot be converted.
    asBoolOr(dynamic json, String key, {bool fallback = false}) bool
    Returns a bool for the value at key, or fallback if conversion fails.
    asBoolOrNull(dynamic json, String key) bool?
    ==================== bool conversions
    asDateTime(dynamic json, String key) DateTime
    Returns a DateTime for the value at key. Throws a FormatException if the value cannot be parsed.
    asDateTimeOr(dynamic json, String key, {required DateTime fallback}) DateTime
    Returns a DateTime for the value at key, or fallback if parsing fails.
    asDateTimeOrNull(dynamic json, String key) DateTime?
    ==================== DateTime conversions
    asDouble(dynamic json, String key) double
    Returns a double for the value at key. Throws a FormatException if the value cannot be converted.
    asDoubleOr(dynamic json, String key, {double fallback = 0.0}) double
    Returns a double for the value at key, or fallback if conversion fails.
    asDoubleOrNull(dynamic json, String key) double?
    ==================== double conversions
    asInt(dynamic json, String key) int
    Returns an int for the value at key. Throws a FormatException if the value cannot be converted.
    asIntOr(dynamic json, String key, {int fallback = 0}) int
    Returns an int for the value at key, or fallback if conversion fails.
    asIntOrNull(dynamic json, String key) int?
    ==================== int conversions
    asList<T>(dynamic json, String key, {T fromJson(dynamic json)?}) List<T>
    Converts the value at key to a List.
    asListInt(dynamic json, String key, {int fromJson(dynamic json)?}) List<int>
    Returns a Listint for the value at key. Throws a FormatException if the value is not a list of ints.
    asListIntOr(dynamic json, String key, {List<int> fallback = const [], int fromJson(dynamic json)?}) List<int>
    Returns a Listint for the value at key, or fallback if conversion fails.
    asListIntOrNull(dynamic json, String key, {int fromJson(dynamic json)?}) List<int>?
    ==================== Listint conversions
    asListOr<T>(dynamic json, String key, {List<T> fallback = const [], T fromJson(dynamic json)?}) List<T>
    Converts the value at key to a List.
    asListOrNull<T>(dynamic json, String key, {T fromJson(dynamic json)?}) List<T>?
    ==================== List conversions (generic)
    asListString(dynamic json, String key, {String fromJson(dynamic json)?}) List<String>
    Returns a List for the value at key. Throws a FormatException if the value is not a list of strings.
    asListStringOr(dynamic json, String key, {List<String> fallback = const [], String fromJson(dynamic json)?}) List<String>
    Returns a List for the value at key, or fallback if conversion fails.
    asListStringOrNull(dynamic json, String key, {String fromJson(dynamic json)?}) List<String>?
    ==================== ListString conversions
    asLocalDateTime(dynamic json, String key) DateTime
    Returns a local DateTime for the value at key. Throws a FormatException if the value cannot be parsed.
    asLocalDateTimeOr(dynamic json, String key, {required DateTime fallback}) DateTime
    Returns a local DateTime for the value at key, or fallback if parsing fails.
    asLocalDateTimeOrNull(dynamic json, String key) DateTime?
    Returns a local DateTime with current timezone if the value at key can be parsed, otherwise null.
    asMap<T, S>(dynamic json, String key) Map<T, S>
    Returns a Map for the value at key. Throws a FormatException if the value is not a map.
    asMapOr<T, S>(dynamic json, String key, {Map<T, S> fallback = const {}}) Map<T, S>
    Returns a Map for the value at key, or fallback if conversion fails.
    asMapOrNull<T, S>(dynamic json, String key) Map<T, S>?
    ==================== Map conversions
    asNum(dynamic json, String key) num
    Returns a num (int or double) for the value at key. Throws a FormatException if the value cannot be converted.
    asNumOr(dynamic json, String key, {num fallback = 0}) num
    Returns a num (int or double) for the value at key, or fallback if conversion fails.
    asNumOrNull(dynamic json, String key) num?
    ==================== num conversions
    asString(dynamic json, String key) String
    Returns a String for the value at key. Throws a FormatException if the value cannot be converted.
    asStringOr(dynamic json, String key, {String fallback = ''}) String
    Returns a String for the value at key, or fallback if conversion fails.
    asStringOrNull(dynamic json, String key) String?
    ==================== String conversions
    asT<T>(dynamic json, String key, {T fromJson(dynamic json)?}) → T
    asTOr<T>(dynamic json, String key, {T fromJson(dynamic json)?, required T fallback}) → T
    asTOrNull<T>(dynamic json, String key, {T fromJson(dynamic json)?}) → T?
    ==================== Generic conversion
    clearClipboard() Future<void>
    Clear the clipboard.
    copyToClipboard(String text) Future<void>
    Copies text to clipboard.
    enterFullScreen() → void
    Enables full-screen immersive mode (hides status and navigation bars).
    exitFullScreen() → void
    Exits full-screen and restores system overlays (status and navigation bars).
    getClipboardText() Future<String?>
    Retrieves text from clipboard.
    hideKeyboard() → void
    Hides the on-screen keyboard, if visible.
    plural(String key, num value, {BuildContext? context, List<String>? args, Map<String, String>? namedArgs, String? name, NumberFormat? format}) String
    function translate with pluralization key Localization key value Number value for pluralization BuildContext The location in the tree where this widget builds args List of localized strings. Replaces {} left to right namedArgs Map of localized strings. Replaces the name keys {key_name} according to its name name Name of number value. Replaces {$name} to value format Formats a numeric value using a NumberFormat class
    setNavigationBarColor({Color color = Colors.black, bool isDark = false}) → void
    Sets the navigation bar color and icon brightness (usually at the bottom).
    setOrientation({bool isPortrait = true, bool allowRotation = false}) → void
    Locks the screen orientation.
    setStatusBarColor({Color color = Colors.transparent, bool isDark = false}) → void
    Sets the status bar color and icon brightness.
    showKeyboard() → void
    Attempts to show the keyboard by requesting focus from the current primary focus node.
    throwIf(bool condition, Object error) → void
    Two handy functions that help me to express my intention clearer and shorter to check for runtime errors
    throwIfNot(bool condition, Object error) → void
    toBeginningOfSentenceCase<T extends String?>(T input, [String? locale]) → T
    Convert a string to beginning of sentence case, in a way appropriate to the locale.
    toBool(dynamic value) bool
    Converts value to bool or throws FormatException if conversion fails.
    toBoolOr(dynamic value, {bool fallback = false}) bool
    Converts value to bool or returns fallback if conversion fails.
    toBoolOrNull(dynamic value) bool?
    Safely converts value to bool, or returns null if conversion fails.
    toDateTime(dynamic value) DateTime
    Converts value to DateTime or throws FormatException if conversion fails.
    toDateTimeOr(dynamic value, {required DateTime fallback}) DateTime
    Converts value to DateTime or returns fallback if conversion fails.
    toDateTimeOrNull(dynamic value) DateTime?
    Safely converts value to DateTime, or returns null if conversion fails.
    toDouble(dynamic value) double
    Converts value to double or throws FormatException if conversion fails.
    toDoubleOr(dynamic value, {double fallback = 0.0}) double
    Converts value to double or returns fallback if conversion fails.
    toDoubleOrNull(dynamic value) double?
    Safely converts value to double, or returns null if conversion fails.
    toInt(dynamic value) int
    Converts value to int or throws FormatException if conversion fails.
    toIntOr(dynamic value, {int fallback = 0}) int
    Converts value to int or returns fallback if conversion fails.
    toIntOrNull(dynamic value) int?
    Safely converts value to an int, or returns null if conversion fails.
    toList<T>(dynamic value, {T fromJson(dynamic json)?}) List<T>
    Converts value to List or throws FormatException if conversion fails.
    toListOr<T>(dynamic value, {List<T> fallback = const [], T fromJson(dynamic json)?}) List<T>
    Converts value to List or returns fallback if conversion fails.
    toListOrNull<T>(dynamic value, {T fromJson(dynamic json)?}) List<T>?
    Safely converts value to List, or returns null if conversion fails.
    toLocalDateTime(dynamic value) DateTime
    Converts value to DateTime in local time zone or throws FormatException if conversion fails.
    toLocalDateTimeOr(dynamic value, {required DateTime fallback}) DateTime
    Converts value to DateTime in local time zone or returns fallback if conversion fails.
    toLocalDateTimeOrNull(dynamic value) DateTime?
    Safely converts value to DateTime in local time zone, or returns null if conversion fails.
    toMap<T, S>(dynamic value) Map<T, S>
    Converts value to Map or throws FormatException if conversion fails.
    toMapOr<T, S>(dynamic value, {Map<T, S> fallback = const {}}) Map<T, S>
    Converts value to Map or returns fallback if conversion fails.
    toMapOrNull<T, S>(dynamic value) Map<T, S>?
    Safely converts value to a Map, or returns null if conversion fails.
    toNum(dynamic value) num
    Converts value to num or throws FormatException if conversion fails.
    toNumOr(dynamic value, {num fallback = 0}) num
    Converts value to num or returns fallback if conversion fails.
    toNumOrNull(dynamic value) num?
    Safely converts value to num, or returns null if conversion fails.
    toString(dynamic value) String
    Converts value to String or throws FormatException if conversion fails.
    toStringOr(dynamic value, {String fallback = ''}) String
    Converts value to String or returns fallback if conversion fails.
    toStringOrNull(dynamic value) String?
    Safely converts value to String, or returns null if conversion fails.
    toT<T>(dynamic value, {required T fromJson(dynamic json)}) → T
    Converts value to T using fromJson or throws FormatException if conversion fails.
    toTOr<T>(dynamic value, {required T fromJson(dynamic json), required T fallback}) → T
    Converts value to T using fromJson or returns fallback if conversion fails.
    toTOrNull<T>(dynamic value, {required T fromJson(dynamic json)}) → T?
    Safely converts value to type T using the fromJson function, or returns null if conversion fails.
    tr(String key, {BuildContext? context, List<String>? args, Map<String, String>? namedArgs, String? gender}) String
    Main function for translate your language keys key Localization key BuildContext The location in the tree where this widget builds args List of localized strings. Replaces {} left to right namedArgs Map of localized strings. Replaces the name keys {key_name} according to its name gender Gender switcher. Changes the localized string based on gender string
    trExists(String key, {BuildContext? context}) bool
    twoDigits(int n) String

    Typedefs

    DisposingFunc<T> = FutureOr Function(T param)
    Signature for disposing function because closures like (x){} have a return type of Null we don't use FutureOr<void>
    Execute<R> = FutureOr<R> Function()
    ExecuteGentle<R> = FutureOr<R> Function(bool ())
    ExecuteGentleWithPort<R> = FutureOr<R> Function(SendPort port, bool ())
    ExecuteWithPort<R> = FutureOr<R> Function(SendPort port)
    FactoryFunc<T> = T Function()
    Signature of the factory function used by non async factories
    FactoryFuncAsync<T> = Future<T> Function()
    Signature of the factory function used by async factories
    FactoryFuncParam<T, P1, P2> = T Function(P1 param1, P2 param2)
    For Factories that expect up to two parameters if you need only one use void for the one you don't use
    FactoryFuncParamAsync<T, P1, P2> = Future<T> Function(P1 param1, P2 param2)
    For async Factories that expect up to two parameters if you need only one use void for the one you don't use
    Mapper<T, S> = FutureOr<S> Function(T data)
    ScopeDisposeFunc = FutureOr Function()
    Signature for disposing function on scope level