covariant method

  1. @override
bool covariant(
  1. dynamic x
)
override

Assert that JavaScript's x is the proper type represented by this Type.

Implementation

@override
bool covariant(x) {
  if (x is! List) {
    return false;
  }
  // `>=` because tuples can be covariant when encoded.
  return x.length >= _fields.length &&
      _components
              .asMap()
              .entries
              .map((t) => t.value.covariant(x[t.key]) ? 0 : 1)
              .reduce((value, element) => value + element) ==
          0;
}