safeCastStrict<T, V> static method
- 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
).
Implementation
static Option<T> safeCastStrict<T, V>(V value) =>
value is T ? Option<T>.of(value) : Option<T>.none();