getValueIfTypeMatched<T> function

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

Returns value as T typecasted if it is of type T; otherwise this returns null.

Implementation

T? getValueIfTypeMatched<T>(dynamic value) {
  if (value is T) {
    return value;
  }
  return null;
}