mirror of
https://github.com/rive-app/rive-flutter
synced 2025-07-05 21:55:58 +00:00
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:
@ -1 +1 @@
|
||||
ad72cfce52f8d419dba13e578224736bd682593c
|
||||
9007b7f92943caf8ae4ba90ba198bfabca5f2b60
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Reference in New Issue
Block a user