cast<T> function

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

Casts x to T if it is of that type, otherwise returns null.

Implementation

T? cast<T>(dynamic x) => x is T ? x : null;