deserialize method

  1. @override
EntityUid deserialize(
  1. Serializers serializers,
  2. Iterable<Object?> serialized, {
  3. FullType specifiedType = FullType.unspecified,
})
override

Deserializes serialized.

serialized is an Iterable that may contain booleans, integers, doubles, Strings and/or Iterables.

Use serializers as needed for nested deserialization. Information about the type being deserialized is provided in specifiedType.

Implementation

@override
EntityUid deserialize(Serializers serializers, Iterable<Object?> serialized,
    {FullType specifiedType = FullType.unspecified}) {
  late String type, id;
  final iterator = serialized.iterator;
  while (iterator.moveNext()) {
    final name = iterator.current as String;
    final value = iterator.moveNext() ? iterator.current : null;
    switch (name) {
      case 'type':
        type = value as String;
      case 'id':
        id = value as String;
    }
  }
  return EntityUid.of(type, id);
}