parseType function

FieldType parseType(
  1. String type, {
  2. bool isEnum = false,
})

Implementation

FieldType parseType(String type, {bool isEnum = false}) {
  final tokens = tokenize(StringStream(type));
  final stream = TokenStream(tokens);

  if (stream.isEmpty) {
    throw ParseError('nothing to parse');
  }

  final parsedType = _parseType(stream);

  if (stream.isNotEmpty) {
    throw ParseError('expected EOF but get ${stream.head()}');
  }

  return parsedType.withEnum(isEnum);
}