Skip to content

Netglade analysis 17 - dart 3.8, flutter 3.32 #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.29.0"
"flutter": "3.32.0"
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.29.0",
"dart.flutterSdkPath": ".fvm/versions/3.32.0",
"search.exclude": {
"**/.fvm": true,
"**/*.g.dart": true
Expand Down
9 changes: 9 additions & 0 deletions packages/netglade_analysis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
## 17.0.0
- Require Dart 3.8.0 (Flutter 3.32.0) or later
- Adhere to Dart lints 3.7.0
- Add unnecessary_underscores
- Add strict_top_level_inference
- Remove package_api_docs
- Remove unsafe_html
- Adhere to Dart lints 3.8.0
- Add use_null_aware_elements
- Add unnecessary_ignore
- Adhere to DCM 1.28.1
- Add avoid-recursive-tostring
- Add avoid-enum-values-by-index
Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_analysis/lib/dcm.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version 1.27.0 - https://dcm.dev/changelog
# version 1.28.1 - https://dcm.dev/changelog
dart_code_metrics:
rules:
### Common
Expand Down
24 changes: 17 additions & 7 deletions packages/netglade_analysis/lib/lints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ analyzer:
deprecated_member_use_from_same_package: warning
record_literal_one_positional_no_trailing_comma: error

# version 3.6.0 - https://github.com/dart-lang/sdk/blob/main/pkg/linter/CHANGELOG.md
formatter:
page_width: 120
trailing_commas: preserve

# version 3.8.0 - https://github.com/dart-lang/sdk/blob/main/pkg/linter/CHANGELOG.md
linter:
rules:
### ERROR
Expand Down Expand Up @@ -54,10 +58,10 @@ linter:
- throw_in_finally
- unnecessary_statements
- unrelated_type_equality_checks
- unsafe_html
# - unsafe_variance # ! experimental
- use_build_context_synchronously
- use_key_in_widget_constructors
# - use_truncating_division # ! unreleased
- use_truncating_division
- valid_regexps

### STYLE
Expand All @@ -78,7 +82,7 @@ linter:
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
# - avoid_futureor_void # ! unreleased
# - avoid_futureor_void # ! experimental
# - avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
Expand Down Expand Up @@ -141,11 +145,11 @@ linter:
- null_check_on_nullable_type_parameter
- null_closures
- omit_local_variable_types
# - omit_obvious_local_variable_types # ! unreleased
# - omit_obvious_local_variable_types # ! experimental
# - omit_obvious_property_types # ! experimental
- one_member_abstracts
- only_throw_errors
- overridden_fields
# - package_api_docs
- package_prefixed_library_names
- parameter_assignments
# - prefer_adjacent_string_concatenation # we don't like adjacent strings
Expand Down Expand Up @@ -195,13 +199,16 @@ linter:
- sort_child_properties_last
# - sort_constructors_first
- sort_unnamed_constructors_first
# - specify_nonobvious_local_variable_types # ! undreleased
# - specify_nonobvious_local_variable_types # ! experimental
# - specify_nonobvious_property_types # ! experimental
- strict_top_level_inference
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unintended_html_in_doc_comment
# - unnecessary_async # ! experimental
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_breaks
Expand All @@ -212,6 +219,7 @@ linter:
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_getters_setters
- unnecessary_ignore
- unnecessary_lambdas
- unnecessary_late
- unnecessary_library_name
Expand All @@ -225,6 +233,7 @@ linter:
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unnecessary_underscores
# - unreachable_from_main
- use_colored_box
- use_decorated_box
Expand All @@ -235,6 +244,7 @@ linter:
- use_is_even_rather_than_modulo
- use_late_for_private_fields_and_variables
- use_named_constants
- use_null_aware_elements
- use_rethrow_when_possible
- use_raw_strings
- use_setters_to_change_properties
Expand Down
1 change: 0 additions & 1 deletion packages/netglade_analysis/lib/lints_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ include: lints.yaml

linter:
rules:
package_api_docs: true
public_member_api_docs: true
2 changes: 1 addition & 1 deletion packages/netglade_analysis/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ screenshots:
path: doc/icon.png

environment:
sdk: ^3.6.0
sdk: ^3.8.0
resolution: workspace
4 changes: 4 additions & 0 deletions packages/netglade_flutter_utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased
- Require Dart SDK 3.8.0 or later.
- Require Flutter SDK 3.32.0 or later.

## 1.2.0
- Dependencies update.

Expand Down
4 changes: 2 additions & 2 deletions packages/netglade_flutter_utils/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version: 0.0.1
publish_to: none

environment:
sdk: ^3.6.0
flutter: ">=3.27.1"
sdk: ^3.8.0
flutter: ^3.32.0
resolution: workspace

dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ typedef OnPageVisibleCallback = void Function({bool pushedIn});
void useOnPageIsVisible({
required RouteObserver observer,
required OnPageVisibleCallback onPageVisible,
}) =>
useRouteAware(
observer: observer,
onDidPopNext: () => onPageVisible(pushedIn: false),
onDidPush: () {
onPageVisible(pushedIn: true);
},
);
}) => useRouteAware(
observer: observer,
onDidPopNext: () => onPageVisible(pushedIn: false),
onDidPush: () {
onPageVisible(pushedIn: true);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void useRouteAware({
);
}

// ignore: prefer_mixin, prefer-match-file-name, should be private class and should use RouteAware as a mixin
// ignore: prefer-match-file-name, should be private class and should use RouteAware as a mixin
class _RouteCallbacks with RouteAware {
final VoidCallback? onDidPop;
final VoidCallback? onDidPopNext;
Expand Down
4 changes: 2 additions & 2 deletions packages/netglade_flutter_utils/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ homepage: https://github.com/netglade/flutter_core
documentation: https://github.com/netglade/flutter_core/tree/main/packages/netglade_flutter_utils

environment:
sdk: ^3.6.0
flutter: ">=3.27.1"
sdk: ^3.8.0
flutter: ^3.32.0
resolution: workspace

dependencies:
Expand Down
3 changes: 3 additions & 0 deletions packages/netglade_utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Unreleased
- Require Dart SDK 3.8.0 or later.

## 2.5.0
- Dependencies update.

Expand Down
2 changes: 1 addition & 1 deletion packages/netglade_utils/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 0.0.1
publish_to: none

environment:
sdk: ^3.6.0
sdk: ^3.8.0
resolution: workspace

dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ extension FutureExtensions<T> on Future<T> {
timer.cancel();

return result;
}
// ignore: avoid_catches_without_on_clauses, gotta catch them all
catch (e, s) {
} catch (e, s) {
timer.cancel();

return Future.error(e, s);
Expand Down
18 changes: 6 additions & 12 deletions packages/netglade_utils/lib/src/result/option.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,19 @@ final class None<T> extends Option<T> {
TResult map<TResult>({
required NoneCallback<TResult> none,
required SomeCallback<TResult, T> some,
}) =>
none();
}) => none();

@override
TResult? mapOrNull<TResult>({
NullableNoneCallback<TResult>? none,
NullableSomeCallback<TResult, T>? some,
}) =>
none?.call();
}) => none?.call();

@override
TResult when<TResult>({
required ValueNoneCallback<TResult> none,
required ValueSomeCallback<TResult, T> some,
}) =>
none();
}) => none();
}

final class Some<T> extends Option<T> {
Expand All @@ -69,22 +66,19 @@ final class Some<T> extends Option<T> {
TResult map<TResult>({
required NoneCallback<TResult> none,
required SomeCallback<TResult, T> some,
}) =>
some(this);
}) => some(this);

@override
TResult? mapOrNull<TResult>({
NullableNoneCallback<TResult>? none,
NullableSomeCallback<TResult, T>? some,
}) =>
some?.call(this);
}) => some?.call(this);

@override
TResult when<TResult>({
required ValueNoneCallback<TResult> none,
required ValueSomeCallback<TResult, T> some,
}) =>
some(value);
}) => some(value);
}

// ignore: prefer-single-declaration-per-file, this can be here
Expand Down
18 changes: 6 additions & 12 deletions packages/netglade_utils/lib/src/result/result_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,19 @@ final class Success<S, E> extends Result<S, E> {
TResult map<TResult>({
required SuccessCallback<TResult, S, E> success,
required ErrorCallback<TResult, S, E> error,
}) =>
success(this);
}) => success(this);

@override
TResult? mapOrNull<TResult>({
NullableSuccessCallback<TResult, S, E>? success,
NullableErrorCallback<TResult, S, E>? error,
}) =>
success?.call(this);
}) => success?.call(this);

@override
TResult when<TResult>({
required SuccessValueCallback<TResult, S> success,
required ErrorValueCallback<TResult, E> error,
}) =>
success(this.success);
}) => success(this.success);
}

final class Error<S, E> extends Result<S, E> {
Expand All @@ -68,22 +65,19 @@ final class Error<S, E> extends Result<S, E> {
TResult map<TResult>({
required SuccessCallback<TResult, S, E> success,
required ErrorCallback<TResult, S, E> error,
}) =>
error(this);
}) => error(this);

@override
TResult? mapOrNull<TResult>({
NullableSuccessCallback<TResult, S, E>? success,
NullableErrorCallback<TResult, S, E>? error,
}) =>
error?.call(this);
}) => error?.call(this);

@override
TResult when<TResult>({
required SuccessValueCallback<TResult, S> success,
required ErrorValueCallback<TResult, E> error,
}) =>
error(this.error);
}) => error(this.error);
}

// ignore: prefer-single-declaration-per-file, this can be here
Expand Down
16 changes: 8 additions & 8 deletions packages/netglade_utils/lib/src/testing/mock_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ extension ErrorAnswerOr<T, E> on When<FutureOr<Result<T, E>>> {

extension StreamSubscriptionAnswer<T> on When<StreamSubscription<T>> {
void thenAnswerWithProvidedCallback() => thenAnswer((i) {
final callback = i.positionalArguments.singleOrNull;
final callback = i.positionalArguments.singleOrNull;

// ignore: no-empty-block, it needs to be empty, prefer-typedefs-for-callbacks, private API
return Stream.fromIterable(<T>[]).listen(callback != null ? callback as void Function(T value) : (_) {});
});
// ignore: no-empty-block, it needs to be empty, prefer-typedefs-for-callbacks, private API
return Stream.fromIterable(<T>[]).listen(callback != null ? callback as void Function(T value) : (_) {});
});

void thenAnswerWithCustomStream(Stream<T> stream) => thenAnswer((i) {
final callback = i.positionalArguments.singleOrNull;
final callback = i.positionalArguments.singleOrNull;

// ignore: no-empty-block, it needs to be empty, prefer-typedefs-for-callbacks, private API
return stream.listen(callback != null ? callback as void Function(T value) : (_) {});
});
// ignore: no-empty-block, it needs to be empty, prefer-typedefs-for-callbacks, private API
return stream.listen(callback != null ? callback as void Function(T value) : (_) {});
});
}
2 changes: 1 addition & 1 deletion packages/netglade_utils/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage: https://github.com/netglade/flutter_core
documentation: https://github.com/netglade/flutter_core/tree/main/packages/netglade_utils

environment:
sdk: ^3.6.0
sdk: ^3.8.0
resolution: workspace

dependencies:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: workspace
publish_to: "none"

environment:
sdk: ^3.6.0
sdk: ^3.8.0
workspace:
- packages/netglade_analysis
- packages/netglade_analysis/example
Expand Down
Loading