ScreenData<S extends Screen> class abstract

Holds data shared across all ScreenLayouts of a Screen.

Subclass this to create custom data classes for your screen, then override Screen.createScreenData to return an instance.

class HomeData extends ScreenData<HomeScreen> {
  int counter = 0;

  void increment() => setState(() => counter++);
}

class HomeScreen extends Screen {
  @override
  HomeData createScreenData() => HomeData();

  // Access via screen.screenData in layouts — cast as needed:
  HomeData get data => screenData as HomeData;
}

Call setState to trigger a rebuild of whichever ScreenLayout is currently visible. Has no effect if no layout is mounted.

Implementers

Constructors

ScreenData()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setState(VoidCallback fn) → void
Rebuilds the currently visible ScreenLayout.
toString() String
A string representation of this object.
inherited

Operators

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