add skip to core string type, to avoid trying to parse bytearrays as …

…strings

an approach we could do to sort this out

Diffs=
9007b7f92 add skip to core string type, to avoid trying to parse bytearrays as … (#5503)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
This commit is contained in:
mjtalbot
2023-06-29 13:41:29 +00:00
parent fe30e35068
commit ba5f9afbac
4 changed files with 9 additions and 3 deletions

View File

@ -1 +1 @@
ad72cfce52f8d419dba13e578224736bd682593c
9007b7f92943caf8ae4ba90ba198bfabca5f2b60

View File

@ -3,4 +3,5 @@ import 'package:rive_common/utilities.dart';
// ignore: one_member_abstracts
abstract class CoreFieldType<T extends Object> {
T deserialize(BinaryReader reader);
void skip(BinaryReader reader) => deserialize(reader);
}

View File

@ -5,4 +5,10 @@ class CoreStringType extends CoreFieldType<String> {
@override
String deserialize(BinaryReader reader) =>
reader.readString(explicitLength: true);
@override
void read(BinaryReader reader) {
var length = reader.readVarUint();
reader.read(length);
}
}

View File

@ -74,8 +74,7 @@ void _skipProperty(BinaryReader reader, int propertyKey,
throw UnsupportedError('Unsupported property key $propertyKey. '
'A new runtime is likely necessary to play this file.');
}
// Desrialize but don't do anything with the contents...
field.deserialize(reader);
field.skip(reader);
}
/// Encapsulates a [RiveFile] and provides access to the list of [Artboard]