diff --git a/pkgs/mime/.github/workflows/test-package.yml b/pkgs/mime/.github/workflows/test-package.yml index 342f3a9d7..69bb65747 100644 --- a/pkgs/mime/.github/workflows/test-package.yml +++ b/pkgs/mime/.github/workflows/test-package.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - sdk: [2.18.0, dev] + sdk: [3.0.0, dev] steps: # These are the latest versions of the github actions; dependabot will # send PRs to keep these up-to-date. diff --git a/pkgs/mime/CHANGELOG.md b/pkgs/mime/CHANGELOG.md index 0f9e68634..23be73156 100644 --- a/pkgs/mime/CHANGELOG.md +++ b/pkgs/mime/CHANGELOG.md @@ -3,6 +3,7 @@ * Update video/mp4 mimeType lookup by header bytes. * Add m4b mimeType lookup by extension. * Add `text/markdown` mimeType lookup by extension. +* Require Dart 3.0.0. ## 1.0.4 diff --git a/pkgs/mime/analysis_options.yaml b/pkgs/mime/analysis_options.yaml index b507c06db..41195572c 100644 --- a/pkgs/mime/analysis_options.yaml +++ b/pkgs/mime/analysis_options.yaml @@ -1,5 +1,5 @@ # https://dart.dev/guides/language/analysis-options -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: @@ -9,11 +9,8 @@ analyzer: linter: rules: - - always_declare_return_types - avoid_bool_literals_in_conditional_expressions - - avoid_catching_errors - avoid_classes_with_only_static_members - - avoid_dynamic_calls - avoid_private_typedef_functions - avoid_redundant_argument_values - avoid_returning_null_for_future @@ -22,33 +19,21 @@ linter: - avoid_void_async - cancel_subscriptions - comment_references - - directives_ordering - join_return_with_assignment - - lines_longer_than_80_chars - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - 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_relative_imports - - prefer_single_quotes - - sort_pub_dependencies - test_types_in_equals - - throw_in_finally - - type_annotate_public_apis - - unawaited_futures - unnecessary_await_in_return - - unnecessary_lambdas - - unnecessary_parenthesis + - unnecessary_breaks - unnecessary_raw_strings - - unnecessary_statements - use_if_null_to_convert_nulls_to_bools - use_raw_strings - use_string_buffers diff --git a/pkgs/mime/lib/src/bound_multipart_stream.dart b/pkgs/mime/lib/src/bound_multipart_stream.dart index 6202017fc..cc01fd5b0 100644 --- a/pkgs/mime/lib/src/bound_multipart_stream.dart +++ b/pkgs/mime/lib/src/bound_multipart_stream.dart @@ -150,13 +150,10 @@ class BoundMultipartStream { switch (_controllerState) { case _controllerStateActive: if (_subscription.isPaused) _subscription.resume(); - break; case _controllerStatePaused: if (!_subscription.isPaused) _subscription.pause(); - break; case _controllerStateCanceled: _subscription.cancel(); - break; default: throw StateError('This code should never be reached.'); } @@ -214,7 +211,6 @@ class BoundMultipartStream { _index = _index - _boundaryIndex; _boundaryIndex = 0; } - break; case _boundaryEndingCode: if (byte == char_code.cr) { @@ -224,7 +220,6 @@ class BoundMultipartStream { } else { _expectWhitespace(byte); } - break; case _boundaryEndCode: _expectByteValue(byte, char_code.lf); @@ -234,7 +229,6 @@ class BoundMultipartStream { _tryPropagateControllerState(); } _state = _headerStartCode; - break; case _headerStartCode: _headers = {}; @@ -245,7 +239,6 @@ class BoundMultipartStream { _headerField.add(_toLowerCase(byte)); _state = _headerFieldCode; } - break; case _headerFieldCode: if (byte == char_code.colon) { @@ -256,7 +249,6 @@ class BoundMultipartStream { } _headerField.add(_toLowerCase(byte)); } - break; case _headerValueStartCode: if (byte == char_code.cr) { @@ -266,7 +258,6 @@ class BoundMultipartStream { _headerValue.add(byte); _state = _headerValueCode; } - break; case _headerValueCode: if (byte == char_code.cr) { @@ -274,12 +265,10 @@ class BoundMultipartStream { } else { _headerValue.add(byte); } - break; case _headerValueFoldingOrEndingCode: _expectByteValue(byte, char_code.lf); _state = _headerValueFoldOrEndCode; - break; case _headerValueFoldOrEndCode: if (byte == char_code.sp || byte == char_code.ht) { @@ -298,7 +287,6 @@ class BoundMultipartStream { _state = _headerFieldCode; } } - break; case _headerEndingCode: _expectByteValue(byte, char_code.lf); @@ -314,7 +302,6 @@ class BoundMultipartStream { _headers = null; _state = _contentCode; contentStartIndex = _index + 1; - break; case _contentCode: if (byte == _boundary[_boundaryIndex]) { @@ -337,12 +324,10 @@ class BoundMultipartStream { contentStartIndex ??= _index; _boundaryIndex = 0; } - break; case _lastBoundaryDash2Code: _expectByteValue(byte, char_code.dash); _state = _lastBoundaryEndingCode; - break; case _lastBoundaryEndingCode: if (byte == char_code.cr) { @@ -350,7 +335,6 @@ class BoundMultipartStream { } else { _expectWhitespace(byte); } - break; case _lastBoundaryEndCode: _expectByteValue(byte, char_code.lf); @@ -360,7 +344,6 @@ class BoundMultipartStream { _tryPropagateControllerState(); } _state = _doneCode; - break; default: // Should be unreachable. diff --git a/pkgs/mime/lib/src/magic_number.dart b/pkgs/mime/lib/src/magic_number.dart index 5de7d87ab..cf735f80e 100644 --- a/pkgs/mime/lib/src/magic_number.dart +++ b/pkgs/mime/lib/src/magic_number.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 mime.magic_number; - class MagicNumber { final String mimeType; final List numbers; diff --git a/pkgs/mime/pubspec.yaml b/pkgs/mime/pubspec.yaml index e94727a24..3dd77f9bb 100644 --- a/pkgs/mime/pubspec.yaml +++ b/pkgs/mime/pubspec.yaml @@ -6,8 +6,8 @@ description: >- repository: https://github.com/dart-lang/mime environment: - sdk: '>=2.18.0 <3.0.0' + sdk: ^3.0.0 dev_dependencies: - lints: ^2.0.0 + dart_flutter_team_lints: ^1.0.0 test: ^1.16.0 diff --git a/pkgs/mime/test/mime_multipart_transformer_test.dart b/pkgs/mime/test/mime_multipart_transformer_test.dart index 551bf55c1..109a9bcd8 100644 --- a/pkgs/mime/test/mime_multipart_transformer_test.dart +++ b/pkgs/mime/test/mime_multipart_transformer_test.dart @@ -51,7 +51,6 @@ void _runParseTest( expect(data, equals(expectedParts?[part]!.codeUnits)); } })); - break; case TestMode.delayListen: futures.add( @@ -68,7 +67,6 @@ void _runParseTest( ), ), ); - break; case TestMode.pauseResume: final completer = Completer(); @@ -86,7 +84,6 @@ void _runParseTest( completer.complete(); }); addTearDown(subscription.cancel); - break; } }, onError: (Object error) { // ignore: only_throw_errors