diff --git a/pkgs/http_parser/CHANGELOG.md b/pkgs/http_parser/CHANGELOG.md index 4312f63cc1..29a656a544 100644 --- a/pkgs/http_parser/CHANGELOG.md +++ b/pkgs/http_parser/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.1.3 + +* Makes `CaseInsensitiveMap` an extension type. + Allows `package:collection` to make the class `final`. + ## 4.1.2 * Fixed a bug where parsing quoted header values could require a regex to diff --git a/pkgs/http_parser/lib/src/case_insensitive_map.dart b/pkgs/http_parser/lib/src/case_insensitive_map.dart index ed344e6f24..cc29bbde9d 100644 --- a/pkgs/http_parser/lib/src/case_insensitive_map.dart +++ b/pkgs/http_parser/lib/src/case_insensitive_map.dart @@ -7,19 +7,20 @@ import 'package:collection/collection.dart'; /// A map from case-insensitive strings to values. /// /// Much of HTTP is case-insensitive, so this is useful to have pre-defined. -class CaseInsensitiveMap extends CanonicalizedMap { +extension type CaseInsensitiveMap._(Map _) + implements Map { /// Creates an empty case-insensitive map. - CaseInsensitiveMap() : super(_canonicalizer); + CaseInsensitiveMap() + : this._(CanonicalizedMap(_canonicalize)); - /// Creates a case-insensitive map that is initialized with the key/value - /// pairs of [other]. + /// Creates a case-insensitive map initialized with the entries of [other]. CaseInsensitiveMap.from(Map other) - : super.from(other, _canonicalizer); + : this._(CanonicalizedMap.from(other, _canonicalize)); - /// Creates a case-insensitive map that is initialized with the key/value - /// pairs of [entries]. + /// Creates a case-insensitive map initialized with the [entries]. CaseInsensitiveMap.fromEntries(Iterable> entries) - : super.fromEntries(entries, _canonicalizer); + : this._(CanonicalizedMap.fromEntries( + entries, _canonicalize)); - static String _canonicalizer(String key) => key.toLowerCase(); + static String _canonicalize(String key) => key.toLowerCase(); } diff --git a/pkgs/http_parser/pubspec.yaml b/pkgs/http_parser/pubspec.yaml index 5b3d521801..4b279f7b28 100644 --- a/pkgs/http_parser/pubspec.yaml +++ b/pkgs/http_parser/pubspec.yaml @@ -1,5 +1,5 @@ name: http_parser -version: 4.1.2 +version: 4.1.3 description: >- A platform-independent package for parsing and serializing HTTP formats. repository: https://github.com/dart-lang/http/tree/master/pkgs/http_parser @@ -14,5 +14,5 @@ dependencies: typed_data: ^1.3.0 dev_dependencies: - dart_flutter_team_lints: ^3.0.0 + dart_flutter_team_lints: ^3.1.0 test: ^1.16.6