convertType function

dynamic convertType(
  1. dynamic T
)

Implementation

dynamic convertType(dynamic T) {
  final type = T.type;
  var types = <String, dynamic>{};
  if (type.toString().contains('DbType')) {
    types = dbTypes();
  } else if (type.toString().contains('PrimaryKeyType')) {
    types = primaryKeyTypes();
  } else if (type.toString().contains('DeleteRule')) {
    types = deleteRuleTypes();
  } else if (type.toString().contains('RelationType')) {
    types = relationTypes();
  } else if (type.toString().contains('ObjectType')) {
    types = objectTypes();
  } else if (type.toString().contains('Collate')) {
    types = collateTypes();
  }
  for (var typ in types.entries) {
    if (T.toString().contains('${typ.key} ') ||
        T.toString().contains('\'${typ.key}\'')) {
      //  print('SQFENTITY FIELD TYPE RECOGNIZED: $T       typ.key:${typ.key}');
      return typ.value;
    }
  }
  print(
      'SQFENTITY FIELD TYPE WARNING: ${T.toString()} is not recognised and marked unknown');
  return types['default'];
}