Describe the bug
In hooks_riverpod: ^0.9.2, I am attempting to create a AutoDisposeFutureProvider and all works fine if we didn't defined the AutoDisposeFutureProvider type.
But if I deciared AutoDisposeFutureProvider type, auto import package:riverpod/src/future_provider.dart and run flutter analyze command, the flutter compiler will get Don't import implementation files from another package. warning.
To Reproduce
/// will show "Don't import implementation files from another package." warning
import 'package:riverpod/src/framework.dart';
import 'package:riverpod/src/future_provider.dart';
Future<String> test = Future<String>.delayed(const Duration(seconds: 3), () {
return 'testing';
});
/// `AutoDisposeFutureProvider` and `AutoDisposeProviderReference` doesn't show in the `riverpod.dart`
final AutoDisposeFutureProvider<String> testProvider =
FutureProvider.autoDispose((AutoDisposeProviderReference ref) async {
return await test;
});
Expected behavior
I have noticed that the package:riverpod/riverpod.dart have export src/future_provider.dart but only show FutureProvider. Maybe we should export all all necessary files such as AutoDisposeFutureProvider and AutoDisposeProviderReference.
@ininmm I wonder. Have you same problem with this exempel?
Future<String> test = Future<String>.delayed(const Duration(seconds: 3), () {
return 'testing';
});
锘縡inal testProvider = FutureProvider.autoDispose((ref) async {
return ref.watch(test);
});
@iamarnas The argument should give a Provider instead of a Future.
Currently, classes like AutoDisposeProvider & co are not exported to avoid polluting the auto-complete
Maybe we could have package:riverpod/all_providers.dart or something similar for those who wants to use always_specify_type.
Most helpful comment
Currently, classes like AutoDisposeProvider & co are not exported to avoid polluting the auto-complete
Maybe we could have
package:riverpod/all_providers.dartor something similar for those who wants to usealways_specify_type.