skip to Main Content

Flutter – Riverpod won't refresh when state changes

import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:google_nav_bar/google_nav_bar.dart'; final tabProvider = StateProvider<int>((ref) => 0); class UserPage extends ConsumerWidget { const UserPage({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { // Watch the currentIndexProvider and get its value var currentIndex = ref.watch(tabProvider.notifier).state; print("render"); final…

VIEW QUESTION

Flutter – ProviderContainer and GoRouter

I want to read the GoRouter outside of main() and outside of any widget. GoRouter provider is defined as follows: final goRouterProvider = Provider<GoRouter>( (ref) { return GoRouter(...); } Then when I'm initializing flutter_local_notifications I want to read this provider…

VIEW QUESTION
Back To Top
Search