attribFromJson method Null safety

VertexAttrib attribFromJson(
  1. String name,
  2. Map<String, Object> json
)

Implementation

static VertexAttrib attribFromJson(String name, Map<String, Object> json) {
  final jsonSize = json['size'];
  final jsonType = json['type'];
  final jsonStride = json['stride'];
  final jsonOffset = json['offset'];
  if (jsonSize is int &&
      jsonType is String &&
      jsonStride is int &&
      jsonOffset is int) {
    return VertexAttrib._internal(
        name, jsonSize, jsonType, jsonStride, jsonOffset);
  } else {
    throw UnimplementedError();
  }
}