skip to Main Content

Flutter – Why does Riverod generator not generate an AsyncNotifier in this case?

I want to generate an AsyncNotifier that takes one argument on build: @riverpod class ListController extends _$ListController { late ServiceOne _serviceOne; late ServiceTwo _serviceTwo; @override Future<List<ItemModel>> build(ListModel List) { _serviceOne = ref.read(serviceOneServiceProvider); _serviceTwo = ref.read(serviceTwoServiceProvider); return _fetchListItems(list); } /// A…

VIEW QUESTION

Flutter – This is about how to initialize Riverpod

I am learning about initializing the Provider used by Riverpod on this site. Therefore, it is explained that the following Provider initialization is old. @Riverpod(keepAlive: true) SharedPreferences sharedPreferences(SharedPreferencesRef ref) => throw UnimplementedError(); void main() async { final sharedPreferences = await…

VIEW QUESTION

Unhandled Exception: Bad state: Cannot use "ref" after the widget was disposed : flutter riverpod

`my problem is when i pop this screen then come back , i can't access to ref.read and and exception Bad state: Cannot use "ref" after the widget was disposed import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:learn_with_lina/providers/messages_provider.dart'; class _CallScreenState extends ConsumerState<CallScreen> { void…

VIEW QUESTION

Flutter – I am getting a type 'List<dynamic>' is not a subtype of type 'List<String >' in type cast

I am creating a flutter app and this is the part of code where i am getting the error. I am using flutter_riverpod package as my provider import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:twitter_clone/common/common.dart'; import 'package:twitter_clone/features/tweet/controller/tweet_controller.dart'; class TweetList extends ConsumerWidget {…

VIEW QUESTION
Back To Top
Search