ComponentCodec<T>.stateful constructor

const ComponentCodec<T>.stateful({
  1. required String typeStr,
  2. required T decode(
    1. Object?
    ),
  3. required Object? encode(
    1. T
    ),
})

Create a codec for a component that needs to serialize state.

Implementation

const ComponentCodec.stateful({
  required this.typeStr,
  required T Function(Object?) decode,
  required Object? Function(T) encode,
})  : _decode = decode,
      _encode = encode,
      _create = null;