dartTypeCode method

String dartTypeCode([
  1. GenerationOptions options = const GenerationOptions()
])

The dart type that matches the values of this column. For instance, if a table has declared an IntColumn, the matching dart type name would be int.

Implementation

String dartTypeCode([GenerationOptions options = const GenerationOptions()]) {
  final converter = typeConverter;
  if (converter != null) {
    final needsSuffix = options.nnbd &&
        !options.nullAwareTypeConverters &&
        nullable &&
        !converter.hasNullableDartType;
    final baseType = converter.mappedType.codeString(options);

    final inner = needsSuffix ? '$baseType?' : baseType;
    return isArray ? 'List<$inner>' : inner;
  }

  return variableTypeCode(options);
}