SimpleAppState class

Implementers

Constructors

SimpleAppState({Map<String, dynamic>? data})
  • data: The initial value of the managed state. This can usually be null. This value is assigned by the factory constructor when the data is restored. This value is not subject to automatic copying.
  • SimpleAppState.fromDict(Map<String, dynamic> src, Map<String, CloneableFile Function(Map<String, dynamic>)> fromDictMap)
    (en) Restore this object from the dictionary.
    factory

    Properties

    hashCode → int
    The hash code for this object.
    no setteroverride
    isLoaded ↔ bool
    getter/setter pair
    runtimeType → Type
    A representation of the runtime type of the object.
    no setterinherited

    Methods

    addUIListener(StateSlot key, String subscriberId, void callback()) → void
    (en) Adds a listener for UI updates associated with the specified slot and ID. Normally, you should not use this directly. Instead, consider using a class that extends SlotStatefulWidget or StateSlotBuilder.
    batch(void fn()) → void
    clone() → SimpleAppState
    (en) Returns a deep copy of this object.
    get<T>(StateSlot<T> key) → T
    (en) Retrieves the value associated with the specified slot.
    joinGroup(AppStateGroup group) → void
    (en) Joins the given group for coordinated batch processing. When this state belongs to a group, calling batch on any member will batch all states in the group together.
    leaveGroup() → void
    (en) Leaves the current group.
    loadFromDict(Map<String, dynamic> src, Map<String, CloneableFile Function(Map<String, dynamic>)> fromDictMap, {bool notifyListeners = true}) → void
    (en) Loads state data from a dictionary after creation.
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    notifyAll() → void
    (en) It will batch notifications to all UI listeners immediately.
    removeStateListener() → void
    (en) Remove StateListener.
    removeUIListener({required String subscriberId, StateSlot? key}) → void
    (en) Deletes the UI update listener associated with the specified slot and ID. Normally, you should not use this directly. Instead, consider using a class that extends SlotStatefulWidget or StateSlotBuilder.
    replaceDataFrom(SimpleAppState other, {bool notifyListeners = true}) → void
    (en) For operations such as Undo, the current listeners are retained and only the data is replaced. The data is deep copied. After that, notifications are sent to all UI listeners in a batch process to update. In other words, the screen the user currently has open is automatically updated.
    set<T>(StateSlot<T> key, T value) → void
    (en) Sets the value for the specified slot. Any listeners associated with the slot will be notified of the change.
    setDebugListener(DebugListener? listener) → void
    (en) Adds a debug listener for developers. This listener will notify you of any value changes whenever they are made. Please note that this means that any intermediate changes to values will be tracked during batch processing, etc.
    setInitial<T>(StateSlot<T> key, T value) → void
    (en) This is a set method dedicated to setting the initial value of the Slot. This method does not notify listeners. The value you set is deep-copied internally.
    setStateListener(StateListener? listener) → void
    (en) Adds a listener suitable for managing Undo and Redo. This listener will only notify when the value change is confirmed. For this reason, in batch processing, etc., notification will only be sent once at the end of the processing.
    slot<T>(String name, {required T initial, T caster(dynamic value)?}) → StateSlot<T>
    (en) Returns a typed state slot associated with the given name.
    toDict() → Map<String, dynamic>
    (en) Convert the object to a dictionary. The returned dictionary can only contain primitive types, null, lists or maps with only primitive elements. If you want to include other classes, the target class should inherit from this class and chain calls toDict.
    toString() → String
    A string representation of this object.
    inherited

    Operators

    operator ==(Object other) → bool
    The equality operator.
    override

    Constants

    className → const String
    version → const String