From e7001088b6d34089a0663a501d6843049eacedcd Mon Sep 17 00:00:00 2001 From: Remi Rousselet Date: Tue, 22 Oct 2024 13:40:13 +0200 Subject: [PATCH 1/3] Support stable --- .github/workflows/build.yml | 3 +-- .github/workflows/riverpod_lint.yml | 1 + examples/counter/pubspec.yaml | 2 +- examples/marvel/pubspec.yaml | 2 +- examples/pub/pubspec.yaml | 2 +- examples/random_number/pubspec.yaml | 2 +- examples/stackoverflow/pubspec.yaml | 2 +- examples/todos/pubspec.yaml | 2 +- packages/riverpod/pubspec.yaml | 2 +- packages/riverpod/pubspec_overrides.yaml | 2 +- .../lib/src/riverpod_ast/ref_invocation.dart | 2 +- .../lib/src/riverpod_ast/widget_ref_invocation.dart | 2 +- packages/riverpod_analyzer_utils/pubspec.yaml | 4 ++-- packages/riverpod_analyzer_utils_tests/pubspec.yaml | 2 +- packages/riverpod_generator/pubspec.yaml | 2 +- packages/riverpod_graph/lib/src/analyze.dart | 2 +- packages/riverpod_graph/pubspec.yaml | 2 +- .../src/assists/convert_to_stateful_base_widget.dart | 2 +- .../src/assists/convert_to_stateless_base_widget.dart | 2 +- ...ual_providers_as_generated_provider_dependency.dart | 2 +- .../lib/src/lints/provider_parameters.dart | 10 +++++----- .../scoped_providers_should_specify_dependencies.dart | 2 +- packages/riverpod_lint/pubspec.yaml | 4 ++-- packages/riverpod_lint/pubspec_overrides.yaml | 2 -- packages/riverpod_lint_flutter_test/pubspec.yaml | 4 ++-- website/pubspec_overrides.yaml | 2 +- 26 files changed, 32 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c669164ea..ab80d18f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,7 @@ jobs: strategy: matrix: channel: - # Waiting for WidgetStateProperty to be stable - # - stable + - stable - master package_path: - examples/counter diff --git a/.github/workflows/riverpod_lint.yml b/.github/workflows/riverpod_lint.yml index d5b89e169..4c357c70b 100644 --- a/.github/workflows/riverpod_lint.yml +++ b/.github/workflows/riverpod_lint.yml @@ -26,6 +26,7 @@ jobs: matrix: channel: - master + - stable package_path: - packages/riverpod_analyzer_utils - packages/riverpod_analyzer_utils_tests diff --git a/examples/counter/pubspec.yaml b/examples/counter/pubspec.yaml index b2c4b3b6f..270a678a0 100644 --- a/examples/counter/pubspec.yaml +++ b/examples/counter/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: dev_dependencies: build_runner: ^2.3.3 - custom_lint: ^0.6.5 + custom_lint: ^0.6.0 flutter_test: sdk: flutter freezed: ^2.3.2 diff --git a/examples/marvel/pubspec.yaml b/examples/marvel/pubspec.yaml index 8b64a8c6a..e152e732e 100644 --- a/examples/marvel/pubspec.yaml +++ b/examples/marvel/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 - custom_lint: ^0.6.5 + custom_lint: ^0.6.0 flutter_test: sdk: flutter freezed: ^2.1.0 diff --git a/examples/pub/pubspec.yaml b/examples/pub/pubspec.yaml index 822f2e513..8940ae4ff 100644 --- a/examples/pub/pubspec.yaml +++ b/examples/pub/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 - custom_lint: ^0.6.5 + custom_lint: ^0.6.0 flutter_test: sdk: flutter freezed: ^2.1.0 diff --git a/examples/random_number/pubspec.yaml b/examples/random_number/pubspec.yaml index f1d1e4c72..c401595f8 100644 --- a/examples/random_number/pubspec.yaml +++ b/examples/random_number/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: mockito: ^5.0.13 dev_dependencies: - custom_lint: ^0.6.5 + custom_lint: ^0.6.0 flutter_lints: ^1.0.0 flutter_test: sdk: flutter diff --git a/examples/stackoverflow/pubspec.yaml b/examples/stackoverflow/pubspec.yaml index ec52db7db..6582b1d6b 100644 --- a/examples/stackoverflow/pubspec.yaml +++ b/examples/stackoverflow/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 - custom_lint: ^0.6.5 + custom_lint: ^0.6.0 flutter_test: sdk: flutter freezed: ^2.1.0 diff --git a/examples/todos/pubspec.yaml b/examples/todos/pubspec.yaml index 3aacdc880..5149622a1 100644 --- a/examples/todos/pubspec.yaml +++ b/examples/todos/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 - custom_lint: ^0.6.5 + custom_lint: ^0.6.0 flutter_test: sdk: flutter riverpod_lint: diff --git a/packages/riverpod/pubspec.yaml b/packages/riverpod/pubspec.yaml index dad98236a..6a87a2535 100644 --- a/packages/riverpod/pubspec.yaml +++ b/packages/riverpod/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: state_notifier: ">=0.7.2 <2.0.0" dev_dependencies: - analyzer: ">=5.12.0 <7.0.0" + analyzer: ^6.7.0 expect_error: ^1.0.0 mockito: ^5.0.0 test: ^1.16.0 diff --git a/packages/riverpod/pubspec_overrides.yaml b/packages/riverpod/pubspec_overrides.yaml index 5fe406c11..607c9fadd 100644 --- a/packages/riverpod/pubspec_overrides.yaml +++ b/packages/riverpod/pubspec_overrides.yaml @@ -1,3 +1,3 @@ dependency_overrides: # necessary for mockito - analyzer: ^6.0.0 + analyzer: ^6.7.0 diff --git a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart index 44adc4c45..5d10f567e 100644 --- a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart +++ b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart @@ -21,7 +21,7 @@ abstract class RefInvocation extends RiverpodAst final functionOwner = function.staticElement .cast() ?.declaration - .enclosingElement3; + .enclosingElement; if (functionOwner == null || // Since Ref is sealed, checking that the function is from the package:riverpod diff --git a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart index 79b3ce5d8..d154dec47 100644 --- a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart +++ b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart @@ -26,7 +26,7 @@ abstract class WidgetRefInvocation extends RiverpodAst final functionOwner = function.staticElement .cast() ?.declaration - .enclosingElement3; + .enclosingElement; if (functionOwner == null || // Since Ref is sealed, checking that the function is from the package:riverpod diff --git a/packages/riverpod_analyzer_utils/pubspec.yaml b/packages/riverpod_analyzer_utils/pubspec.yaml index 1458b6ec4..721e8c7b2 100644 --- a/packages/riverpod_analyzer_utils/pubspec.yaml +++ b/packages/riverpod_analyzer_utils/pubspec.yaml @@ -10,10 +10,10 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - analyzer: ^6.9.0 + analyzer: ^6.7.0 collection: ^1.16.0 crypto: ^3.0.2 - custom_lint_core: ^0.6.5 + custom_lint_core: ^0.6.0 freezed_annotation: ^2.2.0 meta: ^1.7.0 path: ^1.8.0 diff --git a/packages/riverpod_analyzer_utils_tests/pubspec.yaml b/packages/riverpod_analyzer_utils_tests/pubspec.yaml index 22ae01a60..36c99a4bf 100644 --- a/packages/riverpod_analyzer_utils_tests/pubspec.yaml +++ b/packages/riverpod_analyzer_utils_tests/pubspec.yaml @@ -6,7 +6,7 @@ environment: sdk: ">=2.18.0 <4.0.0" dependencies: - analyzer: ">=5.12.0 <7.0.0" + analyzer: ^6.7.0 collection: ^1.16.0 freezed_annotation: ^2.2.0 meta: ^1.7.0 diff --git a/packages/riverpod_generator/pubspec.yaml b/packages/riverpod_generator/pubspec.yaml index c745c7e00..b126b1f21 100644 --- a/packages/riverpod_generator/pubspec.yaml +++ b/packages/riverpod_generator/pubspec.yaml @@ -10,7 +10,7 @@ environment: sdk: ">=2.17.0 <4.0.0" dependencies: - analyzer: ^6.5.0 + analyzer: ^6.7.0 build: ^2.0.0 build_config: ^1.0.0 collection: ^1.15.0 diff --git a/packages/riverpod_graph/lib/src/analyze.dart b/packages/riverpod_graph/lib/src/analyze.dart index b65d298e7..3905477f3 100644 --- a/packages/riverpod_graph/lib/src/analyze.dart +++ b/packages/riverpod_graph/lib/src/analyze.dart @@ -683,7 +683,7 @@ class _ProviderName { /// Returns the name of the provider. _ProviderName _displayNameForProvider(VariableElement provider) { final providerName = provider.name; - final enclosingElementName = provider.enclosingElement3?.displayName; + final enclosingElementName = provider.enclosingElement?.displayName; return _ProviderName( providerName: providerName, enclosingElementName: enclosingElementName ?? '', diff --git a/packages/riverpod_graph/pubspec.yaml b/packages/riverpod_graph/pubspec.yaml index 75b957341..dee6aa7a5 100644 --- a/packages/riverpod_graph/pubspec.yaml +++ b/packages/riverpod_graph/pubspec.yaml @@ -11,7 +11,7 @@ environment: sdk: ">=2.15.0 <4.0.0" dependencies: - analyzer: "6.9.0" + analyzer: ^6.7.0 args: ^2.4.0 collection: ^1.0.0 path: ^1.8.2 diff --git a/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart b/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart index 8647482b9..a7ab884d6 100644 --- a/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart +++ b/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart @@ -291,7 +291,7 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { } final element = node.staticElement; if (element is ExecutableElement && - element.enclosingElement3 == widgetClassElement && + element.enclosingElement == widgetClassElement && !elementsToMove.contains(element)) { final offset = node.offset; final qualifier = diff --git a/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart b/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart index 372d0e0d1..8f6e07af4 100644 --- a/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart +++ b/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart @@ -333,7 +333,7 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { } final element = node.staticElement; if (element is ExecutableElement && - element.enclosingElement3 == widgetClassElement && + element.enclosingElement == widgetClassElement && !elementsToMove.contains(element)) { final parent = node.parent; if (parent is PrefixedIdentifier) { diff --git a/packages/riverpod_lint/lib/src/lints/avoid_manual_providers_as_generated_provider_dependency.dart b/packages/riverpod_lint/lib/src/lints/avoid_manual_providers_as_generated_provider_dependency.dart index 3636af9ff..575b9f0d1 100644 --- a/packages/riverpod_lint/lib/src/lints/avoid_manual_providers_as_generated_provider_dependency.dart +++ b/packages/riverpod_lint/lib/src/lints/avoid_manual_providers_as_generated_provider_dependency.dart @@ -30,7 +30,7 @@ class AvoidManualProvidersAsGeneratedProviderDependency if (dependencyElement is! GeneratorProviderDeclarationElement) { reporter.atNode( dependency.provider.provider ?? dependency.provider.node, - code, + _code, ); } } diff --git a/packages/riverpod_lint/lib/src/lints/provider_parameters.dart b/packages/riverpod_lint/lib/src/lints/provider_parameters.dart index d28c9ef0d..ca2ecd0f1 100644 --- a/packages/riverpod_lint/lib/src/lints/provider_parameters.dart +++ b/packages/riverpod_lint/lib/src/lints/provider_parameters.dart @@ -37,25 +37,25 @@ class ProviderParameters extends RiverpodLintRule { if (value is TypedLiteral && !value.isConst) { // Non-const literals always return a new instance and don't override == - reporter.atNode(value, code); + reporter.atNode(value, _code); } else if (value is FunctionExpression) { // provider(() => 42) is bad because a new function will always be created - reporter.atNode(value, code); + reporter.atNode(value, _code); } else if (value is InstanceCreationExpression && !value.isConst) { final instantiatedObject = value.constructorName.staticElement ?.applyRedirectedConstructors(); final operatorEqual = - instantiatedObject?.enclosingElement3.recursiveGetMethod('=='); + instantiatedObject?.enclosingElement.recursiveGetMethod('=='); - final isEqualFromObjectMethod = operatorEqual?.enclosingElement3 + final isEqualFromObjectMethod = operatorEqual?.enclosingElement .safeCast() ?.thisType .isDartCoreObject; if (operatorEqual == null || (isEqualFromObjectMethod ?? true)) { // Doing `provider(new Class())` is bad if the class does not override == - reporter.atNode(value, code); + reporter.atNode(value, _code); } } } diff --git a/packages/riverpod_lint/lib/src/lints/scoped_providers_should_specify_dependencies.dart b/packages/riverpod_lint/lib/src/lints/scoped_providers_should_specify_dependencies.dart index 29b6304e7..2386f90f6 100644 --- a/packages/riverpod_lint/lib/src/lints/scoped_providers_should_specify_dependencies.dart +++ b/packages/riverpod_lint/lib/src/lints/scoped_providers_should_specify_dependencies.dart @@ -58,7 +58,7 @@ class ScopedProvidersShouldSpecifyDependencies extends RiverpodLintRule { if (provider is! GeneratorProviderDeclarationElement) continue; if (!provider.isScoped) { - reporter.atNode(override.expression, code); + reporter.atNode(override.expression, _code); } } } diff --git a/packages/riverpod_lint/pubspec.yaml b/packages/riverpod_lint/pubspec.yaml index bf04155a2..97f7ef40e 100644 --- a/packages/riverpod_lint/pubspec.yaml +++ b/packages/riverpod_lint/pubspec.yaml @@ -11,10 +11,10 @@ environment: sdk: ">=2.17.0 <4.0.0" dependencies: - analyzer: ^6.9.0 + analyzer: ^6.7.0 analyzer_plugin: ^0.11.2 collection: ^1.16.0 - custom_lint_builder: ^0.6.5 + custom_lint_builder: ^0.6.0 meta: ^1.7.0 path: ^1.8.1 riverpod: 2.6.0 diff --git a/packages/riverpod_lint/pubspec_overrides.yaml b/packages/riverpod_lint/pubspec_overrides.yaml index 9ce45e33b..82a782285 100644 --- a/packages/riverpod_lint/pubspec_overrides.yaml +++ b/packages/riverpod_lint/pubspec_overrides.yaml @@ -4,5 +4,3 @@ dependency_overrides: path: ../riverpod riverpod_analyzer_utils: path: ../riverpod_analyzer_utils - # necessary due to outdated mockito dependency - analyzer: ^6.0.0 diff --git a/packages/riverpod_lint_flutter_test/pubspec.yaml b/packages/riverpod_lint_flutter_test/pubspec.yaml index 1f81635a4..e3d37c6fb 100644 --- a/packages/riverpod_lint_flutter_test/pubspec.yaml +++ b/packages/riverpod_lint_flutter_test/pubspec.yaml @@ -15,8 +15,8 @@ dependencies: dev_dependencies: build_runner: ^2.4.6 - custom_lint: ^0.6.5 - custom_lint_core: ^0.6.5 + custom_lint: ^0.6.0 + custom_lint_core: ^0.6.0 freezed: ^2.3.2 json_serializable: ^6.6.1 riverpod_lint: diff --git a/website/pubspec_overrides.yaml b/website/pubspec_overrides.yaml index d1866eb35..5b4484fd3 100644 --- a/website/pubspec_overrides.yaml +++ b/website/pubspec_overrides.yaml @@ -14,5 +14,5 @@ dependency_overrides: path: ../packages/riverpod_analyzer_utils ## Needed due to Flutter not supporting 6.0.0 yet - analyzer: ^6.0.0 + analyzer: ^6.7.0 analyzer_plugin: ^0.11.3 From e38b9d34a8cd3f640730e9b4a76fc905eb8e4855 Mon Sep 17 00:00:00 2001 From: Remi Rousselet Date: Tue, 22 Oct 2024 13:44:06 +0200 Subject: [PATCH 2/3] Changelogs --- packages/riverpod_analyzer_utils/CHANGELOG.md | 7 ++++++- packages/riverpod_generator/CHANGELOG.md | 5 +++++ packages/riverpod_lint/CHANGELOG.md | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/riverpod_analyzer_utils/CHANGELOG.md b/packages/riverpod_analyzer_utils/CHANGELOG.md index bddd72c9d..7e16acba6 100644 --- a/packages/riverpod_analyzer_utils/CHANGELOG.md +++ b/packages/riverpod_analyzer_utils/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased patch + +- Support analyzer >=6.7.0 <7.0.0 + This should make it compatible with Flutter's stable channel. + ## 0.5.5 - 2024-10-12 Bumped minimum analyzer to 6.9.0 @@ -22,7 +27,7 @@ Bump custom_lint - **Breaking** `LegacyProviderDeclarationElement.providerType` is now nullable. - Fix crash when parsing classes with a `ProviderBase` field. - + ## 0.4.3 - 2023-10-28 - `GeneratorProviderDeclaration.createdTypeDisplayString` now always diff --git a/packages/riverpod_generator/CHANGELOG.md b/packages/riverpod_generator/CHANGELOG.md index 5366697ec..c63fa0a47 100644 --- a/packages/riverpod_generator/CHANGELOG.md +++ b/packages/riverpod_generator/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased 2.6.1 + +- Support analyzer >=6.7.0 <7.0.0 + This should make it compatible with Flutter's stable channel. + ## 2.6.0 - 2024-10-20 - Deprecated the generated `Ref` subclasses. diff --git a/packages/riverpod_lint/CHANGELOG.md b/packages/riverpod_lint/CHANGELOG.md index ddfbe9feb..8dfa5f2d9 100644 --- a/packages/riverpod_lint/CHANGELOG.md +++ b/packages/riverpod_lint/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased 2.6.1 + +- Support analyzer >=6.7.0 <7.0.0 + This should make it compatible with Flutter's stable channel. + ## 2.4.0 - 2024-10-20 - `functional_ref` and its quick-fix now expect: From 19446824c4e279140a2173cb2c853fbf2f4903b6 Mon Sep 17 00:00:00 2001 From: Remi Rousselet Date: Tue, 22 Oct 2024 13:49:44 +0200 Subject: [PATCH 3/3] Ignore depreciations notices --- .../lib/src/riverpod_ast/ref_invocation.dart | 1 + .../lib/src/riverpod_ast/widget_ref_invocation.dart | 1 + packages/riverpod_graph/lib/src/analyze.dart | 5 ++++- .../src/assists/convert_to_stateful_base_widget.dart | 5 ++++- .../src/assists/convert_to_stateless_base_widget.dart | 5 ++++- .../lib/src/lints/provider_parameters.dart | 10 +++++++--- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart index 5d10f567e..ef82f5525 100644 --- a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart +++ b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/ref_invocation.dart @@ -21,6 +21,7 @@ abstract class RefInvocation extends RiverpodAst final functionOwner = function.staticElement .cast() ?.declaration + // ignore: deprecated_member_use, necessary to support older versions of analyzer .enclosingElement; if (functionOwner == null || diff --git a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart index d154dec47..63a0f0979 100644 --- a/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart +++ b/packages/riverpod_analyzer_utils/lib/src/riverpod_ast/widget_ref_invocation.dart @@ -26,6 +26,7 @@ abstract class WidgetRefInvocation extends RiverpodAst final functionOwner = function.staticElement .cast() ?.declaration + // ignore: deprecated_member_use, necessary to support older versions of analyzer .enclosingElement; if (functionOwner == null || diff --git a/packages/riverpod_graph/lib/src/analyze.dart b/packages/riverpod_graph/lib/src/analyze.dart index 3905477f3..85ccd68b2 100644 --- a/packages/riverpod_graph/lib/src/analyze.dart +++ b/packages/riverpod_graph/lib/src/analyze.dart @@ -683,7 +683,10 @@ class _ProviderName { /// Returns the name of the provider. _ProviderName _displayNameForProvider(VariableElement provider) { final providerName = provider.name; - final enclosingElementName = provider.enclosingElement?.displayName; + final enclosingElementName = provider + // ignore: deprecated_member_use, necessary to support older versions of analyzer + .enclosingElement + ?.displayName; return _ProviderName( providerName: providerName, enclosingElementName: enclosingElementName ?? '', diff --git a/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart b/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart index a7ab884d6..c6af2373b 100644 --- a/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart +++ b/packages/riverpod_lint/lib/src/assists/convert_to_stateful_base_widget.dart @@ -291,7 +291,10 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { } final element = node.staticElement; if (element is ExecutableElement && - element.enclosingElement == widgetClassElement && + element + // ignore: deprecated_member_use, necessary to support older versions of analyzer + .enclosingElement == + widgetClassElement && !elementsToMove.contains(element)) { final offset = node.offset; final qualifier = diff --git a/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart b/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart index 8f6e07af4..d4878a5e5 100644 --- a/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart +++ b/packages/riverpod_lint/lib/src/assists/convert_to_stateless_base_widget.dart @@ -333,7 +333,10 @@ class _ReplacementEditBuilder extends RecursiveAstVisitor { } final element = node.staticElement; if (element is ExecutableElement && - element.enclosingElement == widgetClassElement && + element + // ignore: deprecated_member_use, necessary to support older versions of analyzer + .enclosingElement == + widgetClassElement && !elementsToMove.contains(element)) { final parent = node.parent; if (parent is PrefixedIdentifier) { diff --git a/packages/riverpod_lint/lib/src/lints/provider_parameters.dart b/packages/riverpod_lint/lib/src/lints/provider_parameters.dart index ca2ecd0f1..80f4cc6ab 100644 --- a/packages/riverpod_lint/lib/src/lints/provider_parameters.dart +++ b/packages/riverpod_lint/lib/src/lints/provider_parameters.dart @@ -45,10 +45,14 @@ class ProviderParameters extends RiverpodLintRule { final instantiatedObject = value.constructorName.staticElement ?.applyRedirectedConstructors(); - final operatorEqual = - instantiatedObject?.enclosingElement.recursiveGetMethod('=='); + final operatorEqual = instantiatedObject + // ignore: deprecated_member_use, necessary to support older versions of analyzer + ?.enclosingElement + .recursiveGetMethod('=='); - final isEqualFromObjectMethod = operatorEqual?.enclosingElement + final isEqualFromObjectMethod = operatorEqual + // ignore: deprecated_member_use, necessary to support older versions of analyzer + ?.enclosingElement .safeCast() ?.thisType .isDartCoreObject;