SerializationHook constructor

SerializationHook({
  1. required String id,
  2. required Future serialize(
    1. HHCtxI ctx
    ),
  3. required Future deserialize(
    1. HHCtxI ctx
    ),
  4. Future<bool> canHandle(
    1. HHCtxI ctx
    )?,
  5. Future<void> onError(
    1. HHCtxI ctx
    )?,
  6. bool silentOnError = false,
  7. bool forStore = true,
})

Implementation

SerializationHook({
  required this.id,
  required this.serialize,
  required this.deserialize,
  this.canHandle,
  this.onError,
  this.silentOnError = false,
  this.forStore = true,
}) {
  if (_registeredHooks.containsKey(id)) {
    throw ArgumentError(
      'A SerializationHook with id "$id" is already registered.',
    );
  }

  _registeredHooks[id] = this;
}