MaterialFile.fromJson constructor

MaterialFile.fromJson(
  1. Map json
)

Reads a saved material. Throws an UnsupportedFormatVersionException for one newer than this reads, a FormatException for one that is broken.

Implementation

factory MaterialFile.fromJson(Map json) {
  final version = versionOf(json);
  if (version > formatVersion) {
    throw UnsupportedFormatVersionException(
      'material',
      version,
      formatVersion,
    );
  }
  return readingJson('Material', () => _fromJson(json));
}