NyState<T extends StatefulWidget > class
abstract
Methods
activate ()
→ void
Called when this object is reinserted into the tree after having been
removed via deactivate .
inherited
afterLoad ({required dynamic child (), Widget ? placeholder , String ? loadingKey })
→ Widget
The afterLoad method will check if the state is loading
If loading it will display the placeholder
widget.
You can also specify the name of the loadingKey
.
afterNotNull (dynamic variable , {required dynamic child (), Widget ? loadingPlaceholder })
→ Widget
The afterNotNull method will check if the state is loading
If loading it will display the placeholder
widget.
You can also specify the name of the loadingKey
.
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: SafeAreaWidget(
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.
inherited
changeLanguage (String language , {bool restartState = true })
→ dynamic
Update the language in the application
color ({String ? themeId })
→ BaseColorStyles
Helper to get the MediaQueryData .
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.
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.
reassemble ()
→ void
Called whenever the application is reassembled during debugging, for
example during hot reload.
inherited
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
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
validator ({required Map <String , String > rules , required Map <String , dynamic > data , Map <String , dynamic > messages = const {} , bool showAlert = true , Duration ? alertDuration , ToastNotificationStyleType alertStyle = ToastNotificationStyleType.WARNING })
→ dynamic
This validator method provides an easy way to validate data.
You can use this method like the example below:
try {
this.validator(rules: {
"email": "email|max:20",
"name": "min:10"
}, data: {
"email": _textEditingEmailController.text,
"name": _textEditingNameController.text
});
whenEnv (String env , {required Function perform , bool shouldSetState = true })
→ dynamic
Perform an action when the application's env
is in a certain state