1. @override
dynamic convertFromPrimitiveValue(value)

Converts a value to a more complex value from a primitive value according to this instance's definition.

This method takes a non-Dart representation of a value (e.g. an HTTP body or database query) and turns it into a Dart representation . How this value is computed depends on this instance's definition.

Source

@override
dynamic convertFromPrimitiveValue(dynamic value) {
  if (type == ManagedPropertyType.datetime && value is String) {
    value = DateTime.parse(value);
  } else if (type == ManagedPropertyType.doublePrecision &&
      value is num) {
    value = value.toDouble();
  } else if (isEnumeratedValue) {
    if (!enumerationValueMap.containsKey(value)) {
      throw new QueryException(QueryExceptionEvent.requestFailure,
          message: "The value '$value' is not valid for '${MirrorSystem.getName(entity.instanceType.simpleName)}.$name'");
    }
    return enumerationValueMap[value];
  }

  // no need to check type here - gets checked by managed backing

  return value;
}