Spec-Zone.ru › Dart 2

dart:core

Метод isMimeType

  1. @Since("2.17")
bool isMimeType(
  1. String mimeType
)
@Since("2.17")

Является ли UriData.mimeType равным mimeType.

Сравнивает MIME-тип URI data: с mimeType с помощью регистронезависимого сравнения, игнорирующего регистр ASCII-букв.

Пустой mimeType считается эквивалентным text/plain, как в аргументе mimeType, так и в самом URI data:.

Реализация

@Since("2.17")
bool isMimeType(String mimeType) {
  int start = _separatorIndices[0] + 1;
  int end = _separatorIndices[1];
  if (start == end) {
    return mimeType.isEmpty ||
        identical(mimeType, "text/plain") ||
        _caseInsensitiveEquals(mimeType, "text/plain");
  }
  if (mimeType.isEmpty) mimeType = "text/plain";
  return (mimeType.length == end - start) &&
      _caseInsensitiveStartsWith(mimeType, _text, start);
}

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-core/UriData/isMimeType.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API