diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4907aa..d155c7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - sdk: [2.12.0, dev] + sdk: [3.0.0, dev] steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - sdk: [2.12.0, dev] + sdk: [3.0.0, dev] steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 96ea582..c1265ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.1.0-wip + +- Require Dart 3.0.0 or greater. +- No longer explicitly name the `matchers.dart` library as `uri.matchers`. + ## 1.0.0 - Enable null safety for this package. diff --git a/analysis_options.yaml b/analysis_options.yaml index 9dca41f..858ebf5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,42 +1,26 @@ -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: - strong-mode: - implicit-casts: false + language: + strict-casts: true + strict-inference: true + strict-raw-types: true linter: rules: - - always_declare_return_types - - avoid_catching_errors - avoid_private_typedef_functions - avoid_redundant_argument_values - avoid_unused_constructor_parameters - cancel_subscriptions - cascade_invocations - - directives_ordering - join_return_with_assignment - - lines_longer_than_80_chars - missing_whitespace_between_adjacent_strings - no_runtimeType_toString - - omit_local_variable_types - - only_throw_errors - package_api_docs - - prefer_asserts_in_initializer_lists - prefer_const_constructors - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals - - prefer_interpolation_to_compose_strings - prefer_relative_imports - - prefer_single_quotes - - sort_pub_dependencies - test_types_in_equals - - throw_in_finally - - type_annotate_public_apis - - unawaited_futures - - unnecessary_lambdas - - unnecessary_null_aware_assignments - - unnecessary_parenthesis - - unnecessary_statements - - use_is_even_rather_than_modulo - use_string_buffers diff --git a/lib/matchers.dart b/lib/matchers.dart index d1dfe1d..283cb54 100644 --- a/lib/matchers.dart +++ b/lib/matchers.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.matchers; - import 'package:matcher/matcher.dart' show Matcher, anything, isA; /// Matches the individual parts of a [Uri]. If a matcher is not specified for a diff --git a/lib/src/encoding.dart b/lib/src/encoding.dart index bdd70aa..a3b840d 100644 --- a/lib/src/encoding.dart +++ b/lib/src/encoding.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.encoding; - import 'utils.dart'; const int _percent = 0x25; diff --git a/lib/src/uri_builder.dart b/lib/src/uri_builder.dart index 8481bd2..231069c 100644 --- a/lib/src/uri_builder.dart +++ b/lib/src/uri_builder.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.builder; - /// A mutable holder for incrementally building [Uri]s. class UriBuilder { String fragment; diff --git a/lib/src/uri_pattern.dart b/lib/src/uri_pattern.dart index 249dac9..b1ff141 100644 --- a/lib/src/uri_pattern.dart +++ b/lib/src/uri_pattern.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.uri_pattern; - import 'package:quiver/collection.dart' show mapsEqual; import 'package:quiver/core.dart' show hash4; diff --git a/lib/src/uri_template.dart b/lib/src/uri_template.dart index 197f0b6..37fa83e 100644 --- a/lib/src/uri_template.dart +++ b/lib/src/uri_template.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.template; - import 'dart:collection' show UnmodifiableListView; import 'package:quiver/pattern.dart' show escapeRegex; @@ -212,15 +210,15 @@ class UriParser extends UriPattern { /// See the RFC for more details. class UriTemplate { final String template; - final List _parts; + final List _parts; UriTemplate(this.template) : _parts = _compile(template); @override String toString() => template; - static UnmodifiableListView _compile(String template) { - final parts = []; + static UnmodifiableListView _compile(String template) { + final parts = []; template.splitMapJoin( _exprRegex, onMatch: (match) { @@ -349,7 +347,7 @@ class UriTemplate { * over to the next _compileX method. */ class _Compiler { - final Iterator _parts; + final Iterator _parts; RegExp? pathRegex; final List pathVariables = []; @@ -412,7 +410,7 @@ class _Compiler { } } - void _compileQuery({Match? match, List? prevParts}) { + void _compileQuery({Match? match, List? prevParts}) { void handleExpressionMatch(Match match) { final expr = match.group(3)!; for (var q in expr.split(',')) { @@ -422,7 +420,7 @@ class _Compiler { } } - void handleLiteralParts(List literalParts) { + void handleLiteralParts(List literalParts) { for (var i = 0; i < literalParts.length; i++) { final subpart = literalParts[i]; if (subpart is String) { @@ -464,7 +462,7 @@ class _Compiler { } } - void _compileFragment({Match? match, List? prevParts}) { + void _compileFragment({Match? match, List? prevParts}) { final fragmentBuffer = StringBuffer(); void handleExpressionMatch(Match match) { @@ -537,8 +535,8 @@ Map _parseMap(String s, String separator) { return map; } -List _splitLiteral(String literal) { - final subparts = []; +List _splitLiteral(String literal) { + final subparts = []; literal.splitMapJoin( _fragmentOrQueryRegex, onMatch: (m) { diff --git a/pubspec.yaml b/pubspec.yaml index 8386ffc..e71720f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,16 +1,16 @@ name: uri -version: 1.0.1-dev +version: 1.1.0-wip description: >- Utilities for building and parsing URIs, including support for parsing URI templates as defined in RFC 6570. repository: https://github.com/google/uri.dart environment: - sdk: '>=2.12.0 <3.0.0' + sdk: ^3.0.0 dependencies: matcher: ^0.12.10 quiver: ^3.0.0 dev_dependencies: - lints: ^1.0.0 + dart_flutter_team_lints: ^1.0.0 test: ^1.16.0 diff --git a/test/encoding_test.dart b/test/encoding_test.dart index 01ff007..04ab654 100644 --- a/test/encoding_test.dart +++ b/test/encoding_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.encoding_test; - import 'package:test/test.dart'; import 'package:uri/src/encoding.dart'; diff --git a/test/spec_test.dart b/test/spec_test.dart index 1366dba..8ba975d 100644 --- a/test/spec_test.dart +++ b/test/spec_test.dart @@ -2,25 +2,24 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.spec_tests; - import 'dart:convert' show json; import 'dart:io'; import 'package:test/test.dart'; import 'package:uri/uri.dart'; -void runSpecTests(String testname, {String? solo}) { - final testFile = File('test/uritemplate-test/$testname.json'); - final testJson = json.decode(testFile.readAsStringSync()); +void runSpecTests(String testName, {String? solo}) { + final testFile = File('test/uritemplate-test/$testName.json'); + final testJson = + json.decode(testFile.readAsStringSync()) as Map; for (var specGroup in testJson.keys) { group(specGroup, () { - final data = testJson[specGroup]; + final data = testJson[specGroup] as Map; final variables = data['variables'] as Map; final testCases = data['testcases'] as List; - for (var testCase in testCases.cast()) { + for (var testCase in testCases.cast>()) { final templateString = testCase[0] as String; if (solo != null && templateString == solo) continue; test(templateString, () { diff --git a/test/uri_builder_test.dart b/test/uri_builder_test.dart index f60b62a..84e898b 100644 --- a/test/uri_builder_test.dart +++ b/test/uri_builder_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.uri_builder_test; - import 'package:test/test.dart'; import 'package:uri/uri.dart'; diff --git a/test/uri_parser_test.dart b/test/uri_parser_test.dart index 20d9f8f..e4fb3ed 100644 --- a/test/uri_parser_test.dart +++ b/test/uri_parser_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.uri_parser_test; - import 'package:test/test.dart'; import 'package:uri/uri.dart'; diff --git a/test/uri_template_test.dart b/test/uri_template_test.dart index 824940b..a4e937c 100644 --- a/test/uri_template_test.dart +++ b/test/uri_template_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.uri_template_test; - import 'package:test/test.dart'; import 'package:uri/uri.dart'; diff --git a/test/uri_test.dart b/test/uri_test.dart index fe1c37f..c4fa415 100644 --- a/test/uri_test.dart +++ b/test/uri_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library uri.uri_test; - import 'package:test/test.dart'; import 'package:uri/uri.dart';