get<T> method

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)) {
    if (T != null && _getObjectData()[key] is T) {
      final T data = _getObjectData()[key];
      return data;
    } else {
      return _getObjectData()[key];
    }
  } else {
    return defaultValue;
  }
}