riverpod
riverpod copied to clipboard
riverpod_generator always runs even though we added runs_before (after version 2.3.3)
I have created a package that automatically generates providers based on the repository. It works if the riverpod_generator: 2.3.3 and below in pubspec.yaml. it does not work for riverpod_generator: 2.3.5 and above
Seems
global_options:
riverpod_repo:
runs_before:
- riverpod_generator
does not work after version 2.3.3
To Reproduce
- Checkout https://github.com/chaturadilan/riverpod_repo_generator
- Change riverpod_generator version to 2.3.5 or higher in https://github.com/chaturadilan/riverpod_repo_generator/blob/main/pubspec.yaml
- Generate the code using
fvm flutter pub run build_runner build --delete-conflicting-outputs
Expected behavior It should generate the providers like with riverpod_generator: 2.3.3 in pubspec.yaml in example.g.dart
That's most likely a source_gen/build issue.
It's low priority for me. I won't spend much time investigating this.
So if it matters for you, feel free to look into it yourself and raise a PR if you found a solution.
I have no plan to work on this, especially with metaprogramming around the corner.
So closing :)
Hi Remi,
When I investigated the issue, I found out it was occurring because of.
https://github.com/rrousselGit/riverpod/commit/06aeaf0b71ca1fe59facf9258e6a33d31c91ae4e#diff-394be403b9b3b307ca0400be48de286400f6abb846b3834065d6ea31c844991e
Any idea why the following code was added? It prevents my .repo.g.dart from executing before .g.dart.
const generatedExtensions = {'.freezed.dart', '.g.dart'};
final shortName = unit.declaredElement?.source.shortName ?? '';
if (generatedExtensions.any(shortName.endsWith)) {
continue;
}
There's no order change with this. It just excludes generated files.