AnimatorGraph.parse constructor

AnimatorGraph.parse(
  1. String source
)

Reads source, the text of an .animator.json, as fromJson does. Throws a FormatException when it is not JSON, not a JSON object, or broken as fromJson says (an UnsupportedFormatVersionException when it is from a newer engine).

Implementation

factory AnimatorGraph.parse(String source) {
  final json = jsonDecode(source);
  if (json is! Map<String, dynamic>) {
    throw FormatException('An animator graph is a JSON object.', source);
  }
  return AnimatorGraph.fromJson(json);
}