matches method

bool matches(
  1. MediaType? other
)

Returns whether this media type and other are the same, ignoring parameters that are not in both media types.

For example, text/html matches text/html;charset=utf-8, but text/html;charset=ascii doesn't. This is basically like contains, but working in both direction.

Implementation

bool matches(MediaType? other) =>
    contains(other) || (other?.contains(this) == true);