getAsType<T> method

T? getAsType<T>(
  1. TypeCode type,
  2. String key
)

Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type.

  • type the TypeCode that defined the type of the result
  • key a key of element to get. Returns element value defined by the typecode or default if conversion is not supported.

See getAsTypeWithDefault

Implementation

T? getAsType<T>(TypeCode type, String key) {
  var defaultValue = T as T;
  return getAsTypeWithDefault<T>(type, key, defaultValue);
}