riverpod
riverpod copied to clipboard
AsyncValue Issue
When utilizing the balanceProvider, the balance.when() method does not consistently enter the loading state as expected. Instead, it either directly throws an error or fails to update the value properly, resulting in unexpected behavior.
balance.when( data: (balance) { setState(() { userBalance = balance; }); return customText( average: widget.average, value: "Balance: ${balance.floor()}", fontSize: topTextFontSize, fontColor: Colors.black, fontWeight: topTextFontWeight, ); }, error: (e, s) { return const Text("-"); }, loading: () { debugPrint("Running"); return const SizedBox( width: 50.0, child: LinearProgressIndicator(), ); }, ),