dartTypeToOpenApi static method

String dartTypeToOpenApi(
  1. String type
)

Converts Dart type to OpenAPI type.

type - The Dart type as a string.

Returns the corresponding OpenAPI type as a string.

Implementation

static String dartTypeToOpenApi(String type) {
  type = type.split('<')[0];
  switch (type) {
    case 'int':
      return 'integer';
    case 'double':
      return 'number';
    case 'num':
      return 'number';
    case 'bool':
      return 'boolean';
    case 'String':
      return 'string';
    case 'List':
      return 'array';
    case 'Map':
      return 'object';

    default:
      return type;
  }
}