restorableState<V> static method

RestorableCell<V> restorableState<V>({
  1. required String restorationId,
  2. V? initial,
  3. V? fromPrimitives(
    1. Object? data
    )?,
  4. Object? toPrimitives(
    1. V? value
    )?,
})

Creates a RestorableCell with the given restorationId and initial.

Parameters:

  • restorationId: Unique Persistence Key. Must be unique within the registering CellRestorationScope.
  • initial: Fresh-Install Value. Used when no persisted data exists.
  • fromPrimitives / toPrimitives: Optional Codecs. Required for non-primitive V; defaults to the primitive codec described on RestorableCell.

Returns:

A RestorableCell that behaves exactly like Cell.state's result until it is registered with a CellRestorationScope.

Implementation

static RestorableCell<V> restorableState<V>({
  required String restorationId,
  V? initial,
  V? Function(Object? data)? fromPrimitives,
  Object? Function(V? value)? toPrimitives,
}) =>
    RestorableCell<V>(
      restorationId: restorationId,
      initial: initial,
      fromPrimitives: fromPrimitives,
      toPrimitives: toPrimitives,
    );