AnyObjectAutoKeepStateData<T> class

auto save data to memory ram

example:

AnyObjectAutoKeepStateData<List<String>>(
  data: [],
  duration_expire: const Duration(minutes: 10),
  onGetDataReFresh: (anyObjectAutoKeepStateData) async {
    if (anyObjectAutoKeepStateData.date_time_expire.isExpired() || anyObjectAutoKeepStateData.data.isEmpty) {
      return (
        data: List.generate(100, (index) {
          return "${index}";
        }).toList(),
        isRefresh: true,
      );
    }
    return (data: <String>[], isRefresh: false);
  },
);

example full usage

Inheritance

Constructors

AnyObjectAutoKeepStateData({required T data, bool is_no_expire = false, AnyObjectAutoKeepStateDataOnGetDataReFresh<T>? onGetDataReFresh, required Duration duration_expire, bool is_skip_auto_set_date_time_expire = false})

Properties

data ↔ T
getter/setter pair
date_time_expire DateTime
getter/setter pair
duration_expire Duration
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
is_no_expire bool
getter/setter pair
is_pending_operation bool
getter/setter pair
is_skip_auto_set_date_time_expire bool
getter/setter pair
onGetDataReFresh AnyObjectAutoKeepStateDataOnGetDataReFresh<T>?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
defaultOnGetDataRefresh(AnyObjectAutoKeepStateData<T> anyObjectAutoKeepStateData) FutureOr<AnyObjectAutoKeepStateDataReturnData<T>>
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
getData() FutureOr<T>
set isRefresh to true for auto save data and set date_time_expire
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset({void onReset(AnyObjectAutoKeepStateData<T> anyObjectAutoKeepStateData)?}) → void
toString() String
A string representation of this object.
inherited
update() → void

Operators

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