toArray method

Map<String, Object?> toArray()

The schema as a JSON Schema map.

Implementation

Map<String, Object?> toArray() {
  final type = _type;
  return <String, Object?>{
    'type': !_nullable
        ? type
        : type is List<Object?>
        ? [...type, 'null']
        : [type, 'null'],
    ..._common,
    ..._keywords,
  };
}