safeCastStrict<T, V> static method

Option<T> safeCastStrict<T, V>(
  1. V value

Safely cast a value to type T.

If value is not of type T, then return a None.

More strict version of Option.safeCast, in which also the input value type must be specified (while in Option.safeCast the type is dynamic).


static Option<T> safeCastStrict<T, V>(V value) =>
    value is T ? Option<T>.of(value) : Option<T>.none();