Does flutter have a method like Activity.resume()
which can tell developer the user has gone back to the activity.
When I pick the data from internet in
createState(): When we create a stateful widget, the Flutter framework instruct to createState() method.
@override _DeveloperLibsWidgetState createState() => _DeveloperLibsWidgetState();
2.mounted(true/false): Once we create a State object, the framework mounted the State object by associating it with a BuildContext before calling initState() method. All widgets have a bool mounted property. It is turned true when the buildContext is assigned.
bool get mounted => _element != null;
initState(): This is the first method called when a stateful widget is created after the class constructor. The initState() is called only once. It must called super.initState().
@override initState() { super.initState(); // TO DO }
didChangeDependencies(): This method is called immediately after initState() method on the first time the widget is built.
@protected @mustCallSuper void didChangeDependencies() {
}
build(): it shows the part of the user interface represented by the widget. The framework calls this method in several different situations: After calling initState() method. The framework always calls build() method after calling didUpdateWidget After receiving a call for setState to update the screen.
@override
Widget build(BuildContext context, MyButtonState state) {
return Container(color: const Color(0xFF2DBD3A));
}
didUpdateWidget(Widget oldWidget): If the parent widget change configuration and has to rebuild this widget. But it's being rebuilt with the same runtimeType, then didUpdateWidget() method is called.
@mustCallSuper @protected void didUpdateWidget(covariant T oldWidget) {
}
setState(): This method is called from the framework and the developer. We can change the internal state of a State object and make the change in a function that you pass to setState().
@override _DeveloperLibsWidgetState createState() => _DeveloperLibsWidgetState();
deactivate(): This is called when State is removed from the widgets tree, but it might be reinserted before the current frame change is finished.
@protected @mustCallSuper void deactivate() { }
dispose(): This is called when the State object is removed permanently. Here you can unsubscribe and cancel all animations, streams, etc.
@protected @mustCallSuper void dispose() { assert(_debugLifecycleState == _StateLifecycle.ready); assert(() { _debugLifecycleState = _StateLifecycle.defunct; return true; }()); }