Skip to main content

View

View is an extension from State.
ViewWidget is an extension from Widget.

Lifecycle#

Most of these callbacks are optionals but can be overriden according to our needs.
Developers should use these callbacks instead of system callbacks to maintain a view.

onCreate#

void onCreate()

This callback is called only when widget creates the view.

onDispose#

void onDispose()

This callback is called only when widget disposes the view.

buildContent#

Widget? buildContent(BuildContext context)

This callback is called only when view builds the content.

notifyChanges#

void notifyChanges(VoidCallback? callback)

Notify changes in the view and schedule an update. Provided callback is immediately called synchronously.

ViewModel#

ViewModel? getViewModel()void setViewModel(ViewModel? viewModel)

Optionally we can assign a view-model for the view. Though optional but should be done inside onCreate.