cast<T> function

T? cast<T>(
  1. dynamic value
)

Implementation

T? cast<T>(dynamic value) {
  if (value == null) {
    return null;
  }

  if (value is T) {
    return value;
  }

  logger.info(
      'cast: Expected a value of type \'$T\', but got one of type \'${value.runtimeType}\'');
  return null;
}