convert method

  1. @override
UndoTree<E> convert(
  1. Map<String, dynamic> input
)
override

Converts input and returns the result of the conversion.

Implementation

@override
UndoTree<E> convert(Map<String, dynamic> input) {
  final codecVersion = input['codecVersion'] as int? ?? 0;

  if (_kCodecDecoders.length < codecVersion) {
    throw const FormatException();
  }
  if (!_kCodecRequiredKeys[codecVersion].containsAll(input.keys.toSet())) {
    throw const FormatException();
  }

  return _kCodecDecoders[codecVersion](input);
}