getDartType method
Maps a schema type (e.g. "string", "int") to its Dart type string.
This is a simple mapping meant for scaffolding; complex types should be updated by the developer after generation.
Implementation
String getDartType(dynamic type) {
if (type == 'int' || type is int) {
return 'int';
}
if (type == 'double' || type is double) {
return 'double';
}
if (type == 'bool' || type is bool) {
return 'bool';
}
if (type == 'list' || type is List) {
return 'List<dynamic>';
}
if (type == 'map' || type is Map) {
return 'Map<String, dynamic>';
}
if (type == 'string' || type is String) {
return 'String';
}
return 'dynamic';
}