Skip to content

Conversation

@rrousselGit
Copy link
Owner

@rrousselGit rrousselGit commented Oct 31, 2025

Summary by CodeRabbit

  • Refactor
    • Generated providers now use runtime-initialized final bindings instead of compile-time consts.
    • Provider constructors and factory initializers are non-const, and dependency / transitive-dependency collections use non-const forms.
    • Immutability/const semantics adjusted across generated code and tests; public API names remain unchanged but initialization semantics and related metadata are updated.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Systematic removal of const constructors and const top-level provider declarations across core libraries, code generator templates, generated examples/tests, and documentation; affected provider dependency collections and some immutability annotations were adjusted accordingly.

Changes

Cohort / File(s) Summary
Core provider infra
packages/riverpod/lib/src/core/*.dart
Removed const from many base/family/provider constructors and removed some @immutable annotations.
Provider implementations
packages/riverpod/lib/src/providers/**, packages/flutter_riverpod/lib/src/providers/legacy/change_notifier_provider.dart
Removed const from internal and public provider constructors (Notifier/Async/Stream/Provider/ChangeNotifier variants).
Generator templates & logic
packages/riverpod_generator/lib/src/{riverpod_generator.dart,templates/*.dart}
Emit non-const provider constructors and final top-level provider variables; convert static const transitive dependency markers to static final.
Generated code (examples, tests, website)
examples/**, packages/riverpod_generator/test/integration/**, packages/riverpod_generator/integration/**, website/docs/**, packages/riverpod_sqflite/example/lib/generated.g.dart, packages/riverpod_generator/test/**, packages/riverpod_lint_flutter_test/test/**
Converted many generated files: top-level const provider declarations → final; private/provider constructors const X._()X._(); dependency lists and transitive dependency holders converted from const collections to non-const (and some static conststatic final).
Generator tests & assertions
packages/riverpod_generator/test/*.dart
Updated local test variable declarations from constfinal and removed same(const ...) identity-based assertions in favor of value literals where applicable.
Changelog
packages/riverpod_generator/CHANGELOG.md
Documented that generated providers are no longer constant; adjusted release section label.
Misc internal tweaks
packages/riverpod/lib/src/core/mutations.dart, packages/riverpod/lib/src/core/proxy_provider_listenable.dart
Removed const from private constructors; added lint ignore comments for equals/hashCode on mutable classes in a few places.

Sequence Diagram(s)

(Skipped) — changes are mechanical declaration/qualifier transformations; no runtime control-flow or new interactions introduced that require a sequence diagram.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Rationale: changes are large in file count but highly repetitive and mechanical (const → final / const constructors → non-const). Review should focus on a few non-mechanical areas.
  • Review attention suggestions:
    • provider core files in packages/riverpod/lib/src/core/* and packages/flutter_riverpod/lib/src/providers/legacy/change_notifier_provider.dart
    • generator template changes in packages/riverpod_generator/lib/src/templates/* and riverpod_generator.dart (ensure emitted code covers all variants)
    • places where dependency collections or static transitive dependency markers were switched from const → non-const/final (potential equality/identity implications)
    • tests that changed assertions (ensure expectations remain correct)

Possibly related PRs

  • Offline #3968 — similar large-scale refactor converting generated providers and private constructors from const to final/non-const.
  • isAutoDispose #4080 — related changes around provider constructor signatures and lifecycle metadata (isAutoDispose propagation) touching generated providers.
  • Sync dev with master #4068 — another PR that applies the same widespread removal of const qualifiers across generated providers and constructors.

Poem

🐰 I hopped through code at dawn’s first light,

Swapped const for final — quiet delight.
No more compile-time, but tidy and fair,
Providers wake up, ready to share.
A little rabbit clap — change is in the air.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Non-const-providers" directly describes the primary change in this pull request: converting provider declarations from const to non-const (final) throughout the codebase. The changeset demonstrates systematic modifications across generated provider files, core library files, and generator templates where const qualifiers are removed from both provider declarations and constructor definitions. The title is clear, concise, and avoids vague terminology, making it obvious to anyone scanning commit history that this PR addresses a fundamental shift in provider immutability semantics.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch non-const-providers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/riverpod_lint_flutter_test/test/lints/scoped_providers_should_specify_dependencies.g.dart (1)

67-80: Consistent conversion pattern applied.

Same conversion pattern as unimplementedScopedProvider - correctly applied.

🧹 Nitpick comments (1)
packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/another.g.dart (1)

53-66: LGTM! Consistent changes for anotherScopedProvider.

The provider declaration, constructor, and dependency lists have been correctly updated. The empty dependency lists on lines 64-65 could technically remain const for a minor optimization, but maintaining consistency with non-empty dependency lists is a reasonable trade-off.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f42f19 and c52f630.

📒 Files selected for processing (107)
  • examples/counter/lib/main.g.dart (2 hunks)
  • examples/pub/lib/detail.g.dart (8 hunks)
  • examples/pub/lib/search.g.dart (3 hunks)
  • examples/stackoverflow/lib/common.g.dart (2 hunks)
  • examples/stackoverflow/lib/question.g.dart (3 hunks)
  • examples/stackoverflow/lib/tag.g.dart (1 hunks)
  • packages/flutter_riverpod/lib/src/providers/legacy/change_notifier_provider.dart (1 hunks)
  • packages/riverpod/lib/src/core/family.dart (4 hunks)
  • packages/riverpod/lib/src/core/foundation.dart (1 hunks)
  • packages/riverpod/lib/src/core/mutations.dart (2 hunks)
  • packages/riverpod/lib/src/core/override_with_value.dart (3 hunks)
  • packages/riverpod/lib/src/core/provider/functional_provider.dart (1 hunks)
  • packages/riverpod/lib/src/core/provider/notifier_provider.dart (1 hunks)
  • packages/riverpod/lib/src/core/provider/provider.dart (2 hunks)
  • packages/riverpod/lib/src/core/proxy_provider_listenable.dart (1 hunks)
  • packages/riverpod/lib/src/providers/async_notifier.dart (1 hunks)
  • packages/riverpod/lib/src/providers/async_notifier/orphan.dart (1 hunks)
  • packages/riverpod/lib/src/providers/notifier.dart (1 hunks)
  • packages/riverpod/lib/src/providers/provider.dart (1 hunks)
  • packages/riverpod/lib/src/providers/stream_notifier.dart (1 hunks)
  • packages/riverpod/lib/src/providers/stream_notifier/orphan.dart (1 hunks)
  • packages/riverpod_generator/CHANGELOG.md (1 hunks)
  • packages/riverpod_generator/integration/build_yaml/lib/dependencies.g.dart (4 hunks)
  • packages/riverpod_generator/integration/build_yaml/lib/main.g.dart (21 hunks)
  • packages/riverpod_generator/lib/src/riverpod_generator.dart (2 hunks)
  • packages/riverpod_generator/lib/src/templates/family.dart (1 hunks)
  • packages/riverpod_generator/lib/src/templates/provider.dart (2 hunks)
  • packages/riverpod_generator/lib/src/templates/provider_variable.dart (1 hunks)
  • packages/riverpod_generator/test/async_notifier_test.dart (2 hunks)
  • packages/riverpod_generator/test/async_test.dart (2 hunks)
  • packages/riverpod_generator/test/dependencies_test.dart (1 hunks)
  • packages/riverpod_generator/test/integration/annotated.g.dart (10 hunks)
  • packages/riverpod_generator/test/integration/async.dart (2 hunks)
  • packages/riverpod_generator/test/integration/async.g.dart (21 hunks)
  • packages/riverpod_generator/test/integration/auto_dispose.g.dart (9 hunks)
  • packages/riverpod_generator/test/integration/dependencies.g.dart (24 hunks)
  • packages/riverpod_generator/test/integration/dependencies2.g.dart (12 hunks)
  • packages/riverpod_generator/test/integration/documented.g.dart (9 hunks)
  • packages/riverpod_generator/test/integration/generated.dart (1 hunks)
  • packages/riverpod_generator/test/integration/generated.g.dart (14 hunks)
  • packages/riverpod_generator/test/integration/hash/hash1.g.dart (3 hunks)
  • packages/riverpod_generator/test/integration/hash/retry.g.dart (4 hunks)
  • packages/riverpod_generator/test/integration/offline.g.dart (11 hunks)
  • packages/riverpod_generator/test/integration/record.g.dart (12 hunks)
  • packages/riverpod_generator/test/integration/scopes.g.dart (3 hunks)
  • packages/riverpod_generator/test/integration/split.g.dart (1 hunks)
  • packages/riverpod_generator/test/integration/stream.dart (2 hunks)
  • packages/riverpod_generator/test/integration/stream.g.dart (13 hunks)
  • packages/riverpod_generator/test/integration/sync.dart (3 hunks)
  • packages/riverpod_generator/test/integration/sync.g.dart (60 hunks)
  • packages/riverpod_generator/test/notifier_test.dart (2 hunks)
  • packages/riverpod_generator/test/stream_notifier_test.dart (2 hunks)
  • packages/riverpod_generator/test/stream_test.dart (2 hunks)
  • packages/riverpod_generator/test/sync_test.dart (3 hunks)
  • packages/riverpod_lint_flutter_test/test/assists/convert_class_based_provider_to_functional/convert_class_based_provider_to_functional.g.dart (5 hunks)
  • packages/riverpod_lint_flutter_test/test/assists/convert_functional_provider_to_class_based/convert_functional_provider_to_class_based.g.dart (3 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/avoid_build_context_in_providers.g.dart (5 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/avoid_public_notifier_properties.g.dart (2 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/functional_ref/functional_ref.g.dart (4 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/notifier_extends/notifier_extends.g.dart (10 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/only_use_keep_alive_inside_keep_alive.g.dart (5 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/protected_notifier_properties.g.dart (16 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/another.g.dart (3 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/missing_dependencies.g.dart (13 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/missing_dependencies2.g.dart (32 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/unused_dependency.g.dart (9 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/provider_parameters.g.dart (2 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/scoped_providers_should_specify_dependencies.g.dart (3 hunks)
  • packages/riverpod_lint_flutter_test/test/lints/unsupported_provider_value.g.dart (30 hunks)
  • packages/riverpod_sqflite/example/lib/generated.g.dart (3 hunks)
  • website/docs/concepts/about_codegen/main.g.dart (2 hunks)
  • website/docs/concepts/about_codegen/provider_type/async_class_future.g.dart (1 hunks)
  • website/docs/concepts/about_codegen/provider_type/async_class_stream.g.dart (1 hunks)
  • website/docs/concepts/about_codegen/provider_type/async_fn_future.g.dart (1 hunks)
  • website/docs/concepts/about_codegen/provider_type/async_fn_stream.g.dart (1 hunks)
  • website/docs/concepts/about_codegen/provider_type/auto_dispose.g.dart (2 hunks)
  • website/docs/concepts/about_codegen/provider_type/family.g.dart (2 hunks)
  • website/docs/concepts/about_codegen/provider_type/family_class.g.dart (2 hunks)
  • website/docs/concepts/about_codegen/provider_type/family_fn.g.dart (2 hunks)
  • website/docs/concepts/about_codegen/provider_type/sync_class.g.dart (1 hunks)
  • website/docs/concepts/about_codegen/provider_type/sync_fn.g.dart (1 hunks)
  • website/docs/concepts2/auto_dispose/cache_for_usage/codegen.g.dart (1 hunks)
  • website/docs/concepts2/auto_dispose/invalidate_family_example/codegen.g.dart (2 hunks)
  • website/docs/concepts2/auto_dispose/keep_alive/codegen.g.dart (1 hunks)
  • website/docs/concepts2/auto_dispose/on_dispose_example/codegen.g.dart (2 hunks)
  • website/docs/concepts2/family/functional/codegen.g.dart (2 hunks)
  • website/docs/concepts2/family/notifier/codegen.g.dart (2 hunks)
  • website/docs/concepts2/offline/custom_duration.g.dart (1 hunks)
  • website/docs/concepts2/offline/destroy_key/codegen.g.dart (1 hunks)
  • website/docs/concepts2/offline/json_persist.g.dart (1 hunks)
  • website/docs/concepts2/offline/manual_persist/codegen.g.dart (1 hunks)
  • website/docs/concepts2/offline/storage/codegen.g.dart (2 hunks)
  • website/docs/concepts2/offline/wait_persist.g.dart (1 hunks)
  • website/docs/concepts2/providers/declaring_many_providers/codegen.g.dart (2 hunks)
  • website/docs/concepts2/scoping/dependencies/codegen.g.dart (1 hunks)
  • website/docs/concepts2/scoping/usage/codegen.g.dart (1 hunks)
  • website/docs/from_provider/family/family.g.dart (2 hunks)
  • website/docs/from_provider/motivation/async_values/async_values.g.dart (3 hunks)
  • website/docs/from_provider/motivation/auto_dispose/auto_dispose.g.dart (2 hunks)
  • website/docs/from_provider/motivation/combine/combine.g.dart (2 hunks)
  • website/docs/from_provider/motivation/same_type/same_type.g.dart (2 hunks)
  • website/docs/how_to/cancel/detail_screen/codegen.g.dart (1 hunks)
  • website/docs/how_to/cancel/detail_screen_cancel/codegen.g.dart (1 hunks)
  • website/docs/how_to/cancel/detail_screen_debounce/codegen.g.dart (1 hunks)
  • website/docs/how_to/cancel/provider_with_extension/codegen.g.dart (1 hunks)
  • website/docs/how_to/eager_initialization/require_value/codegen.g.dart (1 hunks)
  • website/docs/how_to/pull_to_refresh/fetch_activity/codegen.g.dart (1 hunks)
⛔ Files not processed due to max files limit (22)
  • website/docs/how_to/pull_to_refresh/full_app/codegen.g.dart
  • website/docs/how_to/select/select/codegen.g.dart
  • website/docs/how_to/select/select_async/codegen.g.dart
  • website/docs/how_to/testing/notifier_mock/codegen.g.dart
  • website/docs/how_to/testing/provider_to_mock/codegen.g.dart
  • website/docs/introduction/getting_started/dart_hello_world/main.g.dart
  • website/docs/introduction/getting_started/hello_world/hooks_codegen/main.g.dart
  • website/docs/introduction/getting_started/hello_world/main.g.dart
  • website/docs/migration/from_change_notifier/declaration/declaration.g.dart
  • website/docs/migration/from_change_notifier/initialization/initialization.g.dart
  • website/docs/migration/from_change_notifier/migrated/migrated.g.dart
  • website/docs/migration/from_state_notifier/add_listener/add_listener.g.dart
  • website/docs/migration/from_state_notifier/async_notifier/async_notifier.g.dart
  • website/docs/migration/from_state_notifier/build_init/build_init.g.dart
  • website/docs/migration/from_state_notifier/family_and_dispose/family_and_dispose.g.dart
  • website/docs/migration/from_state_notifier/from_state_provider/from_state_provider.g.dart
  • website/docs/migration/from_state_notifier/old_lifecycles/old_lifecycles.g.dart
  • website/docs/migration/from_state_notifier/old_lifecycles_final/old_lifecycles_final.g.dart
  • website/static/snippets/async.g.dart
  • website/static/snippets/combine.g.dart
  • website/static/snippets/create.g.dart
  • website/static/snippets/declare.g.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build (master, packages/riverpod_generator/integration/build_yaml)
  • GitHub Check: build (stable, packages/flutter_riverpod)
  • GitHub Check: build (master, packages/flutter_riverpod/example)
  • GitHub Check: build (master, examples/stackoverflow)
  • GitHub Check: build (master, examples/random_number)
  • GitHub Check: build (stable, packages/riverpod_generator/integration/build_yaml)
  • GitHub Check: build (master, examples/pub)
  • GitHub Check: build (stable, examples/marvel)
  • GitHub Check: build (stable, packages/hooks_riverpod)
  • GitHub Check: build (stable, packages/riverpod_generator)
  • GitHub Check: build (stable, examples/counter)
  • GitHub Check: build (stable, packages/riverpod)
  • GitHub Check: build (stable, examples/pub)
  • GitHub Check: build (stable, packages/riverpod/example)
  • GitHub Check: build (stable, examples/random_number)
  • GitHub Check: riverpod_lint (stable, packages/riverpod_lint_flutter_test)
  • GitHub Check: riverpod_lint (master, packages/riverpod_analyzer_utils_tests)
  • GitHub Check: riverpod_lint (stable, packages/riverpod_analyzer_utils_tests)
  • GitHub Check: riverpod_lint (master, packages/riverpod_lint_flutter_test)
  • GitHub Check: check_generation
🔇 Additional comments (123)
packages/riverpod/lib/src/core/proxy_provider_listenable.dart (1)

77-81: Verify: const constructor should likely be removed per PR objectives.

The PR aims to remove const qualifiers from provider constructors, but line 77 still declares the ProviderElementProxy constructor as const. The ignore hints added on lines 139 and 144 suppress warnings about equality operators on mutable classes, which suggests the class is intended to become mutable—yet the const constructor contradicts this.

Please confirm whether:

  1. The const keyword should be removed from line 77 (aligning with the PR's systematic removal of const), or
  2. This class is intentionally exempt from the const-removal changes

If the const should be removed, apply this diff:

-  const ProviderElementProxy(
+  ProviderElementProxy(
     this.provider,
     this._lense, {
     this.flushElement = false,
   });

Also applies to: 139-145

website/docs/concepts2/auto_dispose/on_dispose_example/codegen.g.dart (1)

15-15: LGTM! Generated code correctly reflects the non-const provider migration.

The changes are consistent and complete:

  • Both provider declarations (otherProvider, exampleProvider) correctly changed from const to final
  • Both private constructors removed the const keyword

Since this is generated code, the changes originate from the code generator and align perfectly with the PR's objective to migrate away from const providers.

Also applies to: 19-19, 55-55, 60-60

packages/riverpod_lint_flutter_test/test/lints/avoid_build_context_in_providers.g.dart (1)

13-13: Generated code changes are consistent with PR objectives.

This is generated code (.g.dart file with "DO NOT MODIFY BY HAND" header), and the changes systematically convert:

  • Top-level provider declarations from const to final (lines 13, 93, 197)
  • Private constructors from const to non-const (lines 17, 76, 96, 151, 201)

All changes are uniform and preserve the structural API. Since this is generated code, any adjustments to the pattern would need to be made in the code generator itself.

Also applies to: 17-17, 76-76, 93-93, 96-96, 151-151, 197-197, 201-201

packages/riverpod_generator/test/integration/annotated.g.dart (1)

16-16: LGTM! Generated code changes are systematic and consistent.

The conversion from const to final for top-level provider declarations and the removal of const qualifiers from all provider and family constructors is applied uniformly across the entire file. Since this is generated code, the transformation appears correct.

Also applies to: 24-24, 82-82, 105-105, 111-111, 162-162, 211-211, 218-218, 276-276, 295-295, 300-300, 337-337, 341-341, 391-391, 396-396, 451-451

packages/riverpod_lint_flutter_test/test/lints/avoid_public_notifier_properties.g.dart (3)

13-13: LGTM: Provider declaration correctly updated to final.

The conversion from const to final aligns with the PR's objective to systematically remove const qualifiers from provider declarations across the codebase.


17-26: LGTM: Constructor correctly made non-const.

The removal of the const qualifier from the GeneratedNotifierProvider._ constructor aligns with the PR's systematic conversion of provider constructors to non-const.


65-72: LGTM: Constructor correctly made non-const.

The removal of the const qualifier from the GeneratedNotifierFamily._ constructor is consistent with the PR's objectives and matches the pattern applied throughout the codebase.

packages/riverpod_generator/test/integration/stream.dart (1)

23-23: LGTM! Provider alias declarations correctly updated.

The conversion from const to final for both provider aliases aligns with the PR's systematic removal of const qualifiers from provider declarations. These changes are consistent and correct.

Also applies to: 56-56

packages/riverpod_generator/test/notifier_test.dart (2)

15-15: LGTM! Correctly updated to align with non-const providers.

The change from const to final is necessary and correct, given that providers are no longer compile-time constants per the PR objective. The test logic remains valid.


75-75: LGTM! Consistent with the const-to-final migration.

The change correctly updates the variable declaration to match the non-const provider pattern. The test continues to verify type compatibility as intended.

packages/riverpod_lint_flutter_test/test/lints/unsupported_provider_value.g.dart (1)

1-984: Generated code changes look consistent.

This generated file correctly implements the PR objective of converting const provider declarations to final and removing const qualifiers from provider constructors. All ~20 providers follow the same pattern:

  • Provider variables declared as final instead of const
  • Private constructors no longer marked as const

Since this is generated code (as indicated by the header), these changes reflect updates to the code generator itself. The output is systematic and consistent across all provider types.

packages/riverpod_lint_flutter_test/test/lints/notifier_extends/notifier_extends.g.dart (1)

1-599: Generated code changes look consistent and complete.

This file is auto-generated by RiverpodGenerator, and all changes systematically convert const provider declarations to final and remove const modifiers from constructors. The transformations are uniform across all six providers (myProvider, _privateClassProvider, genericsProvider, noGenericsProvider, missingGenericsProvider, wrongOrderProvider) and their associated Family classes.

Since this is generated code, the actual changes are in the code generator itself, and this file will be regenerated automatically.

packages/riverpod_lint_flutter_test/test/lints/only_use_keep_alive_inside_keep_alive.g.dart (1)

1-236: LGTM! Generated code correctly reflects the const-to-final migration.

This generated file systematically converts all provider declarations from const to final and removes const from private constructors, consistent with the PR's objectives. The pattern is applied uniformly across all five providers (keepAliveProvider, keepAliveClassProvider, autoDisposeProvider, autoDisposeClassProvider, and fnProvider).

Since this is generated code (marked "DO NOT MODIFY BY HAND"), the changes originate from the updated code generator, which is the correct approach. No behavioral or semantic changes are introduced—only initialization mutability is affected.

website/docs/how_to/cancel/provider_with_extension/codegen.g.dart (2)

15-15: LGTM: Consistent with PR objectives.

The change from const to final for the provider declaration aligns with the PR's objective to convert const provider declarations throughout the codebase. Since this is generated code, the underlying generator change should ensure consistency across all generated providers.


21-21: LGTM: Constructor correctly updated.

The removal of the const qualifier from the private constructor is consistent with the change to final on line 15 and aligns with the PR's systematic removal of const qualifiers from provider constructors.

packages/riverpod_generator/test/integration/hash/hash1.g.dart (3)

13-13: LGTM - Consistent migration from const to final.

The provider declaration and constructor have been correctly updated to remove const qualifiers, aligning with the PR's systematic migration.

Also applies to: 17-17


53-53: LGTM - Pattern consistently applied.

The changes to simple2Provider follow the same pattern as simpleProvider, maintaining consistency across the generated file.

Also applies to: 57-57


93-93: LGTM - Migration complete and consistent.

The changes to simpleClassProvider complete the consistent migration pattern across all providers in this generated file. Note that as a generated file, these changes reflect updates to the code generator itself.

Also applies to: 96-96

packages/riverpod_lint_flutter_test/test/assists/convert_class_based_provider_to_functional/convert_class_based_provider_to_functional.g.dart (2)

14-14: LGTM: Consistent const-to-final conversion for top-level providers.

All three top-level provider declarations have been systematically updated from const to final, which aligns with the PR objectives.

Also applies to: 72-72, 179-179


19-19: LGTM: Consistent removal of const from private constructors.

All private constructor invocations have been updated to remove the const qualifier, which is consistent with the top-level provider declarations now being final rather than const.

Also applies to: 78-78, 135-135, 183-183, 235-235

examples/stackoverflow/lib/question.g.dart (4)

67-67: LGTM! Provider declaration updated to non-const.

The change from const to final aligns with the PR objectives to systematically remove const qualifiers from provider declarations across the codebase.


72-81: LGTM! Constructor updated to non-const.

The removal of the const qualifier from the constructor is consistent with the PR's objectives and matches the top-level provider declaration changes.


121-121: LGTM! Provider declaration updated to non-const.

The change from const to final is consistent with the systematic conversion being applied throughout this PR.


156-165: LGTM! Constructor and dependency initialization updated.

The constructor and dependency list initialization changes are consistent with the PR objectives. Note that the empty lists at lines 163-164 are now non-const, which means new list instances are created instead of using canonical const instances. This appears to be an intentional design choice as part of the broader non-const provider migration.

website/docs/from_provider/motivation/auto_dispose/auto_dispose.g.dart (1)

15-15: Generated code changes are consistent with PR objectives.

The conversion from const to final for provider declarations and the removal of const from private constructors are applied consistently across both diceRollProvider and cachedDiceRollProvider. Since this is generated code, the changes reflect updates to the code generator itself, which aligns with the PR's goal of making providers non-const throughout the codebase.

Also applies to: 19-19, 55-55, 59-59

packages/riverpod_generator/test/integration/offline.g.dart (1)

13-462: LGTM! Generated code transformation is consistent.

The systematic conversion of provider declarations from const to final and the removal of const qualifiers from private constructors is consistently applied across all provider types (functional providers, notifier providers, and families). Since this is generated code, the transformation correctly reflects the updated generator output.

packages/riverpod_generator/test/integration/dependencies2.g.dart (1)

1-438: LGTM! Generated code aligns with PR objectives.

This generated file systematically converts all provider declarations from const to final and removes const qualifiers from constructors and dependency collections, which aligns perfectly with the PR's objective to migrate away from const providers. The changes are consistent across all provider types (functional providers, families, notifiers) and maintain the same functional behavior while shifting to runtime initialization.

packages/riverpod_generator/test/integration/generated.g.dart (1)

13-13: LGTM! Generated code correctly reflects the non-const provider architecture.

The systematic conversion from const to final for top-level provider declarations and the removal of const from private constructors is consistent across all provider types. The generated output correctly implements the architectural change described in the PR objectives.

Also applies to: 18-18, 54-54, 59-59, 114-114, 131-131, 135-135, 184-184, 188-188, 244-244, 283-283, 288-288, 343-343, 360-360, 366-366, 402-402, 408-408, 463-463, 480-480, 484-484, 533-533, 537-537, 592-592

packages/riverpod_generator/test/integration/stream.g.dart (4)

13-13: LGTM! Systematic conversion of provider declarations.

The transformation from const to final for all top-level provider declarations is consistent and aligns with the PR objective to make providers non-const. Since this is generated code, the change reflects an intentional shift in the code generator's output.

Also applies to: 105-105, 228-228, 261-261, 294-294, 409-409, 454-454, 499-499


23-23: LGTM! Consistent removal of const from provider constructors.

All provider class constructors have been systematically converted from const to non-const, which is necessary given that the top-level provider declarations are now final instead of const.

Also applies to: 109-109, 233-233, 266-266, 299-299, 413-413, 458-458, 503-503


74-74: LGTM! Family constructors updated consistently.

The removal of const from all Family class constructors follows the same systematic pattern as the Provider constructors, ensuring consistency across the generated code.

Also applies to: 154-154, 378-378, 563-563


1-1: Generated code reflects systematic transformation.

This file contains generated code from riverpod_generator. All changes consistently convert const provider declarations to final and remove const from constructors throughout the file. The transformation is systematic and aligns with the PR's architectural shift. Any concerns about this approach should be addressed at the code generator level rather than in the generated output.

Also applies to: 9-9

packages/flutter_riverpod/lib/src/providers/legacy/change_notifier_provider.dart (1)

93-102: LGTM! Change aligns with PR objectives.

The removal of the const qualifier from the internal constructor is consistent with the PR's goal of converting providers to non-const. Since this constructor is marked @internal, the impact is limited to internal package usage.

packages/riverpod_generator/test/integration/hash/retry.g.dart (1)

13-13: Generated code looks correct for const → final conversion.

The generated code correctly implements the systematic conversion from const to final provider declarations and removes const qualifiers from all private constructors. The changes are consistent throughout the file, and all constructor super calls remain valid in the non-const context.

Also applies to: 17-17, 53-53, 57-57, 110-110, 126-126, 130-130

packages/riverpod_lint_flutter_test/test/lints/scoped_providers_should_specify_dependencies.g.dart (2)

13-26: LGTM! Consistent conversion from const to final.

The conversion from const to final for the provider declaration, removal of const from the constructor, and removal of const qualifiers from the dependency lists are all consistent and correct. The non-const constructor requires non-const arguments in the super() initializer.


107-120: Correct conversion with null dependencies.

The conversion follows the same pattern as the other providers. Note that rootProvider uses null for dependencies (lines 118-119) rather than empty lists, so no const removal is needed there - this is correct.

packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/another.g.dart (2)

13-26: LGTM! Systematic const-to-final conversion for bProvider.

The provider declaration and constructor have been correctly updated from const to final/non-const. Since this is generated code, the changes reflect updates to the code generator itself.


93-111: LGTM! Correct propagation of const-to-final changes.

The changes to anotherNonEmptyScopedProvider are correct and demonstrate proper propagation of the const-to-final conversion. Notably, line 111 correctly updates the static field $allTransitiveDependencies0 from const to final, since it references anotherScopedProvider which is now final.

website/docs/concepts2/scoping/usage/codegen.g.dart (1)

15-15: LGTM! Generated code correctly reflects the non-const provider transformation.

The systematic removal of const qualifiers is correctly applied throughout:

  • Provider declaration changed from const to final (line 15)
  • Constructor call no longer uses const (line 20)
  • Dependency lists are now runtime-initialized (lines 27-28)

These changes are consistent with the PR objectives to convert providers from compile-time constants to runtime-initialized instances.

Also applies to: 20-20, 27-28

packages/riverpod_generator/test/stream_notifier_test.dart (1)

15-15: LGTM! Consistent const-to-final conversion.

The changes from const to final for these local provider variable declarations are correct and align with the PR's systematic removal of const qualifiers from providers. These modifications also improve internal consistency, as other similar declarations in this file (lines 104, 111) already use final.

Also applies to: 77-77

website/docs/concepts/about_codegen/provider_type/auto_dispose.g.dart (2)

15-20: Const-to-final migration looks correct.

The provider stays canonical while aligning with the updated non-const pattern—looks good.


55-60: Second provider update is consistent.

example2Provider follows the same safe const-to-final shift—no concerns here.

packages/riverpod_generator/test/integration/record.g.dart (3)

13-13: Generated provider declarations correctly migrated to non-const.

All top-level provider declarations have been systematically converted from const to final. The generated code correctly implements runtime initialization while preserving functionality.

Also applies to: 90-90, 187-187, 256-256, 346-346, 415-415


18-27: Provider constructors correctly updated to non-const.

All provider constructors have had their const qualifiers removed while preserving parameter lists and initialization logic. The generated code maintains functional equivalence.

Also applies to: 93-102, 192-201, 260-269, 351-360, 419-428


73-80: Family constructors correctly updated to non-const.

All family constructors have had their const qualifiers removed. The generated code consistently applies the non-const pattern across all provider families.

Also applies to: 148-155, 239-246, 307-314, 398-405, 466-473

website/docs/from_provider/motivation/combine/combine.g.dart (2)

15-15: LGTM: Provider declarations converted to final.

The generated provider declarations correctly reflect the transition from const to final. Since this is generated code, the real change is in the code generator. The providers remain immutable through final while allowing runtime instantiation.

Also applies to: 55-55


19-19: LGTM: Constructors correctly made non-const.

The private constructors are appropriately converted from const to non-const, consistent with the provider declarations. The generated code is internally consistent with no const initializers that would conflict.

Also applies to: 59-59

packages/riverpod_generator/test/integration/documented.g.dart (1)

16-16: Generated code changes are correct and match intentional architectural update.

All provider declarations use final instead of const because the code generator has been intentionally updated as a breaking change. This is documented in the CHANGELOG under "Unreleased major" as: "Generated providers are no-longer constant."

The generator templates (provider_variable.dart and provider.dart) have been updated to produce non-const provider declarations and constructors. Test coverage is present across all provider types (functional, class-based, and family) with consistent output in multiple .g.dart test files.

website/docs/concepts2/auto_dispose/invalidate_family_example/codegen.g.dart (1)

15-15: Generated documentation example is correctly updated; no verification needed.

This is an auto-generated documentation example file that is not integrated into tests or the framework. The removal of const qualifiers is consistent with the PR objective and does not introduce risks in this context.

The original review's concerns about provider identity and framework-wide behavior apply to production code, not isolated documentation examples that are not used in provider lookup or override scenarios.

packages/riverpod_generator/test/dependencies_test.dart (1)

173-192: The review comment is incorrect—different data structures require different test assertions.

The apparent "inconsistency" stems from testing different data structures:

  • Lines 173–180 test Lists (<ProviderOrFamily>[...]) using direct equality
  • Line 184 tests a Set (<ProviderOrFamily>{...}) using same() for identity

This pattern is consistent throughout the test file: Lists use value equality checks while Sets use identity checks via same(). This distinction is intentional and correct—the code does not have the issue flagged in the review comment.

Likely an incorrect or invalid review comment.

packages/riverpod_generator/test/integration/scopes.g.dart (5)

13-13: LGTM: Provider declaration correctly changed to final.

The transformation from const to final is consistent with the PR objective.


16-25: LGTM: Constructor and dependency initialization correctly updated.

The constructor and dependency list initializations have been properly converted to non-const forms, maintaining consistency with the provider declaration change.


65-65: LGTM: Family provider declaration correctly changed to final.

Consistent with the same transformation applied to scopedClassProvider.


69-78: LGTM: Family provider constructor correctly updated.

The constructor has been properly converted to non-const. Note that this family provider uses null for dependencies (lines 76-77), which differs from the non-family provider's empty list pattern but appears intentional.


117-124: LGTM: Family class constructor and dependencies correctly updated.

The constructor and dependency initialization follow the same transformation pattern as the non-family provider, ensuring consistency across the generated code.

packages/riverpod_generator/test/integration/async.dart (1)

29-29: LGTM – Consistent with PR objective.

The conversion from const to final aligns with the systematic removal of const qualifiers from provider declarations across the codebase.

Also applies to: 65-65

website/docs/concepts2/auto_dispose/cache_for_usage/codegen.g.dart (1)

15-15: LGTM – Generated code updated consistently.

The provider declaration and constructor correctly reflect the non-const pattern adopted in this PR.

Also applies to: 20-20

packages/riverpod_generator/test/async_test.dart (1)

15-15: LGTM – Test code updated to match non-const providers.

Local variable declarations correctly updated from const to final to align with the new provider initialization semantics.

Also applies to: 69-69

website/docs/concepts2/family/notifier/codegen.g.dart (1)

15-15: LGTM – Family provider pattern updated consistently.

The top-level provider binding and both family-related constructors correctly reflect the non-const initialization pattern.

Also applies to: 19-28, 66-73

packages/riverpod_generator/CHANGELOG.md (1)

1-3: LGTM – Breaking change properly documented.

The version bump from patch to major and the clear changelog entry appropriately reflect the breaking nature of removing const from generated providers.

website/docs/concepts2/offline/custom_duration.g.dart (1)

32-32: LGTM – Offline provider updated consistently.

Provider declaration and constructor correctly converted to non-const pattern while preserving all initialization parameters.

Also applies to: 37-46

website/docs/concepts2/offline/destroy_key/codegen.g.dart (1)

32-32: LGTM – Consistent non-const conversion.

Provider declaration and constructor updated to match the non-const pattern adopted across the codebase.

Also applies to: 37-46

website/docs/concepts/about_codegen/provider_type/async_fn_future.g.dart (1)

15-15: LGTM – Documentation example updated correctly.

Provider declaration and constructor follow the non-const pattern consistently with the rest of the codebase changes.

Also applies to: 20-29

website/docs/how_to/cancel/detail_screen_debounce/codegen.g.dart (1)

15-21: Provider stays singleton without const canonicalization.
Switching the generated binding to final with a non-const private constructor keeps a single runtime instance while aligning with the new non-const provider model. Looks good.

packages/riverpod_generator/test/stream_test.dart (2)

15-15: Test alias updated appropriately.
Using final here keeps the alias valid now that providers are no longer const expressions.


89-89: Family handle mirrors new provider semantics.
This alias also needs to be final; the update is correct and keeps the test compiling.

packages/riverpod_generator/test/async_notifier_test.dart (2)

14-14: Alias adjustment matches non-const providers.
final keeps this helper binding usable with the new generator output.


78-78: Family alias modernized.
Switching to final is required for parity with the non-const family provider; change looks good.

website/docs/concepts/about_codegen/provider_type/sync_fn.g.dart (1)

15-20: Doc snippet matches generator changes.
final plus a non-const constructor keeps the example accurate under the non-const provider rollout.

website/docs/concepts2/providers/declaring_many_providers/codegen.g.dart (1)

15-60: Multiple providers updated consistently.
Both generated providers now follow the final/non-const pattern, keeping the docs aligned with the core change.

website/docs/concepts/about_codegen/provider_type/family_class.g.dart (1)

15-15: LGTM! Systematic conversion from const to final/non-const.

The changes consistently convert the provider from const to final and remove const qualifiers from constructors, aligning with the PR's objective to move away from compile-time constant providers.

Also applies to: 18-18, 73-73

website/docs/concepts2/auto_dispose/keep_alive/codegen.g.dart (1)

15-15: LGTM! Consistent const removal.

The provider declaration and constructor changes align with the systematic refactoring pattern observed throughout the PR.

Also applies to: 20-20

packages/riverpod_generator/test/sync_test.dart (1)

171-171: LGTM! Test variables updated to match non-const providers.

The test declarations correctly reflect the change from const to final providers, validating that the refactoring maintains expected behavior.

Also applies to: 183-183, 209-209

packages/riverpod_generator/test/integration/split.g.dart (1)

13-13: LGTM! Consistent refactoring in test integration file.

The changes follow the established pattern of converting const to final for provider declarations and removing const from constructors.

Also applies to: 17-17

packages/riverpod/lib/src/core/mutations.dart (2)

62-62: LGTM! Constructor converted to non-const.

The private constructor change aligns with the PR's systematic removal of const qualifiers from provider constructors.


89-96: LGTM! Appropriate lint suppressions added for mutable class.

The ignore comments for avoid_equals_and_hash_code_on_mutable_classes are correctly added since the class is no longer const-constructible. The equality and hashCode logic remains unchanged.

packages/riverpod/lib/src/core/family.dart (1)

50-56: LGTM! Systematic const removal from family constructors.

All family class constructors (Family, $Family, FunctionalFamily, ClassFamily) have been consistently updated to remove const qualifiers while preserving all parameters and initialization logic.

Also applies to: 70-76, 132-141, 230-239

website/docs/how_to/eager_initialization/require_value/codegen.g.dart (1)

15-15: LGTM! Documentation example updated consistently.

The generated documentation code correctly reflects the const-to-final conversion pattern.

Also applies to: 20-20

examples/counter/lib/main.g.dart (1)

17-17: LGTM! Example code updated with new provider pattern.

The counter example correctly demonstrates the new final provider declaration and non-const constructor pattern.

Also applies to: 28-28

website/docs/how_to/pull_to_refresh/fetch_activity/codegen.g.dart (1)

15-15: LGTM! Consistent const-to-final conversion.

The changes correctly convert the top-level provider from const to final and remove the const qualifier from the private constructor, aligning with the PR's systematic migration.

Also applies to: 21-21

packages/riverpod/lib/src/core/provider/notifier_provider.dart (1)

388-396: LGTM! Core constructor updated to non-const.

The removal of the const qualifier from the $ClassProvider constructor is consistent with the PR's architectural shift. The constructor signature and parameters remain unchanged, maintaining compatibility.

packages/riverpod_sqflite/example/lib/generated.g.dart (1)

29-29: LGTM! Multiple providers consistently updated.

Both storageProvider and todosProvider follow the same const-to-final pattern with their corresponding constructor updates. The changes are consistent across functional and notifier provider types.

Also applies to: 41-41, 71-71, 76-76

website/docs/concepts2/family/functional/codegen.g.dart (1)

15-15: LGTM! Family provider pattern correctly updated.

The changes properly handle the family provider pattern, updating both the top-level userProvider, the UserProvider member constructor, and the UserFamily constructor to non-const forms.

Also applies to: 20-20, 67-67

examples/pub/lib/search.g.dart (1)

15-15: LGTM! Family provider with record parameter correctly updated.

The fetchPackagesProvider family correctly implements the const-to-final conversion across the provider declaration and both constructor definitions.

Also applies to: 25-25, 77-77

packages/riverpod/lib/src/providers/stream_notifier/orphan.dart (1)

67-76: LGTM! Internal constructor updated consistently.

The removal of const from the StreamNotifierProvider.internal constructor aligns with the broader architectural change. The internal constructor maintains its full parameter list and behavior.

website/docs/concepts2/offline/manual_persist/codegen.g.dart (1)

15-15: LGTM! AsyncNotifier provider correctly updated.

The todoListProvider changes follow the established pattern for async notifier providers, with both the declaration and constructor updated appropriately.

Also applies to: 19-19

website/docs/concepts2/offline/json_persist.g.dart (1)

27-27: LGTM! JSON persistence provider correctly updated.

The todoListProvider with JSON persistence follows the same const-to-final pattern as the manual persist variant, maintaining consistency across the persistence API.

Also applies to: 32-32

website/docs/from_provider/motivation/same_type/same_type.g.dart (1)

15-15: LGTM! Consistent const-to-final conversion.

The changes systematically convert provider declarations from const to final and remove const qualifiers from constructors, aligning with the PR's objective to move away from compile-time constant providers.

Also applies to: 20-20, 56-56, 61-61

packages/riverpod/lib/src/providers/provider.dart (1)

37-46: LGTM! Core constructor updated to support non-const providers.

Removing const from the internal constructor enables the runtime initialization pattern used throughout the generated code. This is a foundational change that supports the broader migration away from compile-time constant providers.

website/docs/concepts/about_codegen/provider_type/family_fn.g.dart (1)

15-15: LGTM! Family provider pattern updated consistently.

The family provider and its associated constructors have been updated to use final declarations and non-const constructors, maintaining consistency with the overall pattern of this PR.

Also applies to: 19-28, 74-81

examples/stackoverflow/lib/common.g.dart (1)

19-19: LGTM! Provider and dependency collections updated consistently.

The provider declaration and constructor have been updated to non-const, and the empty dependency collections (lines 40-41) have also been converted from const to non-const literals, which is appropriate in the non-const constructor context.

Also applies to: 33-42

packages/riverpod_lint_flutter_test/test/lints/provider_parameters.g.dart (1)

13-13: LGTM! Test providers updated consistently.

The test provider declarations and constructors follow the same const-to-final pattern as the production code, ensuring test coverage aligns with the new provider instantiation model.

Also applies to: 17-26, 72-79

packages/riverpod/lib/src/core/override_with_value.dart (3)

8-17: LGTM! Base value provider constructor updated.

The _ValueProvider constructor has been updated to non-const, which is consistent with the broader migration and enables runtime initialization flexibility for value-based provider overrides.


43-57: LGTM! Sync value provider updated.

The $SyncValueProvider constructor follows the same pattern, removing const to support the non-const instantiation model.


135-143: LGTM! Async value provider updated.

The $AsyncValueProvider constructor completes the value provider family's migration to non-const constructors.

packages/riverpod_lint_flutter_test/test/lints/functional_ref/functional_ref.g.dart (1)

13-13: LGTM! Multiple test providers updated consistently.

All provider declarations (nameless, generics, and valid) and their associated constructors have been updated to follow the non-const pattern. The changes are consistent across simple providers, family providers, and generic providers.

Also applies to: 17-26, 53-53, 58-66, 116-123, 146-146, 150-159

packages/riverpod_lint_flutter_test/test/assists/convert_functional_provider_to_class_based/convert_functional_provider_to_class_based.g.dart (1)

14-14: LGTM! Assist test providers updated consistently.

The test providers for the functional-to-class-based conversion assist have been updated to use the non-const pattern, ensuring the assist generates code that matches the new provider instantiation model.

Also applies to: 21-30, 59-59, 66-75, 123-130

packages/riverpod_lint_flutter_test/test/lints/protected_notifier_properties.g.dart (1)

13-688: Const-to-final migration verified. Generated providers/families remain coherent after dropping const constructors; overrides and equality continue to match previous semantics.

packages/riverpod_lint_flutter_test/test/lints/provider_dependencies/unused_dependency.g.dart (1)

13-404: Dependencies lists remain correct. Swapping const providers and const dependency arrays for final/non-const counterparts keeps dependency wiring intact.

packages/riverpod_generator/integration/build_yaml/lib/main.g.dart (1)

13-892: Generated build_yaml bindings look good. Reviewed families/notifier providers; non-const constructors and final globals line up with the broader migration with no behavioral drift.

packages/riverpod_generator/test/integration/sync.g.dart (1)

13-2808: Extensive sync generator sweep confirmed. The blanket const-to-final updates across providers/families remain mechanically sound and preserve type coverage.

packages/riverpod/lib/src/providers/notifier.dart (1)

45-53: Core constructor aligns with the migration. Making $NotifierProvider non-const matches the generated code updates and keeps internal wiring unchanged.

packages/riverpod_generator/lib/src/templates/provider_variable.dart (1)

23-23: LGTM! Consistent template update for non-const providers.

The template correctly generates final declarations instead of const for both family and non-family provider cases, aligning with the PR's objective to move away from compile-time constant providers.

Also applies to: 28-28

website/docs/concepts/about_codegen/provider_type/async_class_stream.g.dart (1)

15-15: LGTM! Generated code reflects template changes correctly.

The generated provider declaration is now final and the private constructor is no longer const, consistent with the PR's objectives. All constructor parameters and initialization logic remain unchanged.

Also applies to: 18-27

packages/riverpod/lib/src/providers/async_notifier.dart (1)

39-47: LGTM! Constructor signature preserved with const removed.

The $AsyncNotifierProvider constructor correctly removes the const qualifier while maintaining all parameter requirements. This enables runtime instantiation of providers as intended by the PR.

packages/riverpod/lib/src/providers/stream_notifier.dart (1)

39-47: LGTM! Consistent with async_notifier.dart changes.

The $StreamNotifierProvider constructor properly removes the const qualifier while preserving all parameters, mirroring the pattern established in async_notifier.dart.

packages/riverpod_generator/lib/src/templates/family.dart (1)

61-68: LGTM! Family template updated consistently.

The family constructor template correctly removes the const qualifier while maintaining the private constructor pattern and all initialization parameters passed to super().

website/docs/how_to/cancel/detail_screen/codegen.g.dart (1)

33-33: LGTM! Documentation example updated correctly.

The generated code demonstrates the new pattern with final provider declaration and non-const private constructor, consistent with other generated outputs in the PR.

Also applies to: 39-48

packages/riverpod_generator/lib/src/riverpod_generator.dart (2)

193-199: LGTM! Dependencies collection no longer const.

The generated dependencies parameter correctly emits a non-const typed list, aligning with the PR's shift to runtime instantiation.


207-224: LGTM! Transitive dependencies collection no longer const.

The generated allTransitiveDependencies parameter correctly emits non-const collections (list or set based on size), consistent with the dependencies change above.

packages/riverpod/lib/src/providers/async_notifier/orphan.dart (1)

80-89: LGTM! Internal constructor updated consistently.

The AsyncNotifierProvider.internal constructor correctly removes the const qualifier while preserving all parameters, consistent with the public $AsyncNotifierProvider constructor changes.

website/docs/concepts/about_codegen/provider_type/async_class_future.g.dart (1)

15-15: LGTM! Consistent const-to-final conversion.

The provider declaration and constructor have been correctly updated from const to final/non-const, aligning with the PR's objective to make providers non-const.

Also applies to: 18-18

website/docs/concepts/about_codegen/provider_type/async_fn_stream.g.dart (1)

15-15: LGTM! Consistent const-to-final conversion.

The changes follow the same pattern as other generated files in this PR.

Also applies to: 20-20

packages/riverpod_generator/lib/src/templates/provider.dart (2)

109-117: LGTM! Template correctly generates non-const constructors.

The constructor template has been updated to generate non-const constructors, which is the core change driving all the generated file updates in this PR.


126-129: LGTM! Transitive dependencies now use final instead of const.

The transitive dependency declarations have been correctly updated from static const to static final, which is necessary since the parent provider constructors are no longer const.

website/docs/from_provider/motivation/async_values/async_values.g.dart (1)

15-15: LGTM! Consistent const-to-final conversion for multiple providers.

Both itemsApiProvider and evenItemsProvider follow the expected pattern.

Also applies to: 25-25, 53-53, 58-58

website/docs/concepts/about_codegen/provider_type/family.g.dart (1)

15-15: LGTM! Family providers correctly updated.

Both ExampleProvider and ExampleFamily constructors have been updated to non-const, maintaining consistency with the PR's objectives.

Also applies to: 19-22, 74-81

website/docs/from_provider/family/family.g.dart (1)

15-15: LGTM! Random provider family correctly updated.

The RandomProvider and RandomFamily constructors follow the expected non-const pattern.

Also applies to: 19-28, 74-81

website/docs/concepts/about_codegen/main.g.dart (1)

15-15: LGTM! FetchUser provider family correctly updated.

All constructors follow the non-const pattern established by the template.

Also applies to: 20-29, 67-74

website/docs/concepts/about_codegen/provider_type/sync_class.g.dart (1)

15-15: LGTM! Sync class provider correctly updated.

The changes are consistent with the PR's systematic conversion from const to non-const providers.

Also applies to: 18-27

packages/riverpod_generator/test/integration/async.g.dart (3)

13-13: LGTM! Consistent conversion of provider declarations.

The systematic conversion from const to final for all top-level provider declarations is consistent with the PR objectives. Since this is generated code and each provider is instantiated once at module initialization, the runtime performance impact should be negligible.

Also applies to: 104-104, 223-223, 344-344, 377-377, 410-410, 479-479, 594-594, 639-639, 684-684, 774-774, 915-915


23-31: LGTM! Constructor changes align with non-const provider pattern.

All private constructor declarations have been consistently updated to remove the const qualifier while preserving parameters and initialization lists. This change is necessary to support the non-const provider instances declared at the top level.

Also applies to: 73-80, 108-116, 152-159, 227-236, 272-279, 349-358, 382-391, 415-424, 462-469, 484-500, 563-570, 598-607, 643-652, 688-697, 735-742, 778-794, 838-845, 919-933, 978-985


1-1074: Verify integration tests pass after code generation.

The sandbox environment lacks a Dart compiler, so I cannot run the integration tests directly. Since this is generated code, manual verification is required to confirm the generator produces valid code that passes all integration tests.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/riverpod_generator/test/scoped_test.dart (1)

45-52: LGTM! The value-based assertions are appropriate for non-const providers.

The change from identity checks to value equality aligns with the PR's migration away from const providers. Consider using the isEmpty matcher for better readability:

-    expect(
-      scopedClassFamilyProvider.$allTransitiveDependencies,
-      const <ProviderOrFamily>[],
-    );
+    expect(
+      scopedClassFamilyProvider.$allTransitiveDependencies,
+      isEmpty,
+    );
     expect(
       scopedClassProvider.$allTransitiveDependencies,
-      const <ProviderOrFamily>[],
+      isEmpty,
     );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c52f630 and 8ce03bb.

📒 Files selected for processing (2)
  • packages/riverpod_generator/test/dependencies_test.dart (3 hunks)
  • packages/riverpod_generator/test/scoped_test.dart (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/riverpod_generator/test/dependencies_test.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: riverpod_lint (stable, packages/riverpod_lint_flutter_test)
  • GitHub Check: riverpod_lint (stable, packages/riverpod_analyzer_utils)
  • GitHub Check: riverpod_lint (stable, packages/riverpod_lint)
  • GitHub Check: riverpod_lint (master, packages/riverpod_analyzer_utils_tests)
  • GitHub Check: riverpod_lint (stable, packages/riverpod_analyzer_utils_tests)
  • GitHub Check: riverpod_lint (master, packages/riverpod_lint_flutter_test)
  • GitHub Check: check_generation
  • GitHub Check: build (master, packages/flutter_riverpod/example)
  • GitHub Check: build (master, packages/flutter_riverpod)
  • GitHub Check: build (master, packages/riverpod_generator)
  • GitHub Check: build (stable, packages/flutter_riverpod/example)
  • GitHub Check: build (master, examples/counter)
  • GitHub Check: build (master, examples/random_number)
  • GitHub Check: build (stable, packages/flutter_riverpod)

@rrousselGit rrousselGit merged commit b945ca0 into master Oct 31, 2025
45 checks passed
@rrousselGit rrousselGit deleted the non-const-providers branch October 31, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants