dataTypeOf static method

int dataTypeOf(
  1. Object o
)

Returns data type of given object

Implementation

static int dataTypeOf(Object o) {
  while (o is List) {
    o = o.elementAt(0);
  }
  Object c = o;
  if (c is double) {
    return TfLiteType.kTfLiteFloat32;
  } else if (c is int) {
    return TfLiteType.kTfLiteInt32;
  } else if (c is String) {
    return TfLiteType.kTfLiteString;
  } else if (c is bool) {
    return TfLiteType.kTfLiteBool;
  }
  throw ArgumentError(
      'DataType error: cannot resolve DataType of ${o.runtimeType}');
}