rrousselGit / riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
https://riverpod.dev
MIT License
6.24k stars 955 forks source link

riverpod_annotation exports Ref type. #3791

Closed koji-1009 closed 2 hours ago

koji-1009 commented 4 hours ago

Is your feature request related to a problem? Please describe. It would be nice if riverpod_annotation would export the Ref for riverpod 2.6.0 support.

current (riverpod_annotaion v2.6.0)

import 'package:riverpod/riverpod.dart'; // ← Required for import of Ref
import 'package:riverpod_annotation/riverpod_annotation.dart';

@riverpod
Model foo(Ref ref) => ..

want

import 'package:riverpod_annotation/riverpod_annotation.dart';

@riverpod
Model foo(Ref ref) => ..

Describe the solution you'd like Add the Ref type to the export list in riverpod_annotation/riverpod_annotatino.dart.

Describe alternatives you've considered none.

Additional context https://github.com/rrousselGit/riverpod/blob/master/packages/riverpod_generator/CHANGELOG.md#260---2024-10-20

rrousselGit commented 2 hours ago

It isn't exported on purpose.

The annotation package only exports what the generated code uses. You're not meant to import riverpod_annotation as a replacement to Riverpod.

koji-1009 commented 1 hour ago

OK, so riverpod_generator is a mechanism to generate, not to provide some kind of meta-programming.

I agree with your design. Thanks for the review.