typeCheckConverter<C extends Converter<T>> method

  1. @protected
C typeCheckConverter<C extends Converter<T>>(
  1. Converter<T> other
)

Throws an ArgumentError if the Types of the two Converters don't match and returns the casted converter otherwise.

Implementation

@protected
C typeCheckConverter<C extends Converter<T>>(Converter<T> other) {
  if (runtimeType != other.runtimeType) {
    throw ArgumentError.value(
      other,
      'Cannot convert between $runtimeType and ${other.runtimeType}',
    );
  }

  return other as C;
}