NyState<T extends StatefulWidget> class abstract

Inheritance

Constructors

NyState({String? path})
Base NyState

Properties

allowStateUpdates bool
Check if the state should listen for events via the EventBus.
no setter
context BuildContext
The location in the tree where this widget builds.
no setterinherited
eventBus EventBus?
Helper to get the EventBus.
no setter
hashCode int
The hash code for this object.
no setterinherited
initialLoad bool
Check if the initState has already been loaded.
getter/setter pair
mediaQuery MediaQueryData
Helper to get the MediaQueryData.
no setter
mounted bool
Whether this State object is currently in a tree.
no setterinherited
requiresBoot bool
If set, the boot method will not be called.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showInitialLoader bool
Should the initial loader be displayed.
no setter
stateData ↔ dynamic
The stateData contains the last value set from a updateState() call.
getter/setter pair
stateName String?
The stateName is used as the ID for the UpdateState class.
getter/setter pair
textTheme TextTheme
Helper to get the TextTheme.
no setter
useSkeletonizer bool
Enable the Skeletonizer widget.
no setter
widget → T
The current configuration.
no setterinherited

Methods

activate() → void
Called when this object is reinserted into the tree after having been removed via deactivate.
inherited
afterLoad({required dynamic child(), Widget? loading, String? loadingKey}) Widget
The afterLoad method will check if the state is loading If loading it will display the loading widget. You can also specify the name of the loadingKey.
afterNotLocked(String name, {required dynamic child(), Widget? loading}) Widget
The afterNotLocked method will check if the state is locked, if the state is locked it will display the loading widget.
afterNotNull(dynamic variable, {required dynamic child(), Widget? loading}) Widget
The afterNotNull method will check if the variable passed in is null If the variable is not null, it will display the loading widget.
awaitData({String name = 'default', required Function perform, bool shouldSetStateBefore = true, bool shouldSetStateAfter = true}) → dynamic
Use the awaitData method when initial fetching data for a widget. E.g. When your page first loads and you want to populate your widgets with data.
boot() → dynamic
The boot method called within init. You may override this method for making asynchronous awaits. In your build method, you can use the afterLoad method like in the below example. @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: afterLoad(child: () => Container() ) ); } This will then only display the widget after the boot method has completed.
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
changeLanguage(String language, {bool restartState = true}) → dynamic
Update the language in the application
confirmAction(dynamic action(), {required String title, String dismissText = "Cancel"}) → dynamic
Allow the user to confirm an action. Provide a title for the confirm button. You can also provide a dismissText for the cancel button. E.g. confirmAction(() { ... perform action }, title: "Confirm Action", dismissText: "Cancel");
data({String? key}) → dynamic
Get data from the NyStatefulWidget controller.
deactivate() → void
Called when this object is removed from the tree.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
didChangeDependencies() → void
Called when a dependency of this State object changes.
inherited
didUpdateWidget(covariant T oldWidget) → void
Called whenever the widget configuration changes.
inherited
dispose() → void
Called when this object is removed from the tree permanently.
override
init() → dynamic
Initialize your widget in init.
initState() → void
Called when this object is inserted into the tree.
override
isLoading({String name = 'default'}) bool
Checks the value from your loading map. Provide the name of the loader.
isLocked(String name) bool
Checks the value from your lock map. Provide the name of the lock.
loading(BuildContext context) Widget
Display a loading widget.
lockRelease(String name, {required Function perform, bool shouldSetState = true}) → dynamic
The lockRelease method will call the function provided in perform and then block the function from being called again until it has finished.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pop({dynamic result}) → dynamic
Pop the current widget from the stack.
queryParameters({String? key}) → dynamic
Get queryParameters from the NyStatefulWidget controller.
reassemble() → void
Called whenever the application is reassembled during debugging, for example during hot reload.
inherited
reboot() → dynamic
Reboot your widget.
setLoading(bool value, {String name = 'default', bool resetState = true}) → dynamic
Set the value of a loading key by padding a true or false
setState(VoidCallback fn) → void
Notify the framework that the internal state of this object has changed.
override
showToast({ToastNotificationStyleType style = ToastNotificationStyleType.SUCCESS, required String title, required String description, IconData? icon, Duration? duration}) → dynamic
Show a toast notification
showToastCustom({String? title, String? description, ToastNotificationStyleType? style}) → dynamic
Display a custom Toast message.
showToastDanger({String? title, required String description, ToastNotificationStyleType? style}) → dynamic
Displays a Toast message containing "Error" for the title, you only need to provide a description.
showToastInfo({String? title, required String description, ToastNotificationStyleType? style}) → dynamic
Displays a Toast message containing "Info" for the title, you only need to provide a description.
showToastOops({String? title, required String description, ToastNotificationStyleType? style}) → dynamic
Displays a Toast message containing "Oops" for the title, you only need to provide a description.
showToastSorry({String? title, required String description, ToastNotificationStyleType? style}) → dynamic
Displays a Toast message containing "Sorry" for the title, you only need to provide a description.
showToastSuccess({String? title, required String description, ToastNotificationStyleType? style}) → dynamic
Displays a Toast message containing "Success" for the title, you only need to provide a description.
showToastWarning({String? title, required String description, ToastNotificationStyleType? style}) → dynamic
Displays a Toast message containing "Warning" for the title, you only need to provide a description.
stateUpdated(dynamic data) → dynamic
When you call updateState, this method will be called within your State. The data parameter will contain any data passed from the updateState method.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
validate({required Map<String, dynamic> rules, Map<String, dynamic>? data, Map<String, dynamic>? messages, bool showAlert = true, Duration? alertDuration, ToastNotificationStyleType alertStyle = ToastNotificationStyleType.WARNING, required dynamic onSuccess()?, dynamic onFailure(Exception exception)?, String? lockRelease}) → dynamic
Validate data from your widget.
view(BuildContext context) Widget
Display your widget.
whenEnv(String env, {required Function perform, bool shouldSetState = true}) → dynamic
Perform an action when the application's env is in a certain state

Operators

operator ==(Object other) bool
The equality operator.
inherited