cast<T> function Null safety

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

Implementation

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