cast<T> static method

T cast<T>(
  1. dynamic x, {
  2. required T fallback,
})

Implementation

static T cast<T>(dynamic x, {required T fallback}) => x is T ? x : fallback;