get<T> method Null safety

T? get<T>(
  1. String key,
  2. {T? defaultValue}
)

Gets type T from objectData

Returns null or defaultValue if provided. To get an int, call getType and an int will be returned, null, or a defaultValue if provided

Implementation

T? get<T>(String key, {T? defaultValue}) {
  if (_getObjectData().containsKey(key)) {
    return _getObjectData()[key] as T?;
  } else {
    return defaultValue;
  }
}