Material3DFile.parse constructor

Material3DFile.parse(
  1. String source
)

Reads source, a material file's text.

Implementation

factory Material3DFile.parse(String source) {
  final Object? json;
  try {
    json = jsonDecode(source);
  } on FormatException catch (e) {
    throw FormatException('This material is not JSON: ${e.message}');
  }
  if (json is! Map) {
    throw const FormatException('A material file holds a JSON object.');
  }
  return Material3DFile.fromJson(json);
}