safeCastStrict<L, R, V> static method
Safely cast a value to type R.
If value is not of type R, then return a Left
containing the result of onError.
More strict version of Either.safeCast, in which also the input value
type must be specified (while in Either.safeCast the type is dynamic).
Implementation
static Either<L, R> safeCastStrict<L, R, V>(
V value,
L Function(V value) onError,
) =>
value is R ? Either<L, R>.of(value) : Either<L, R>.left(onError(value));