rrousselGit / riverpod

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

AsyncValue Issue #3481

Open LokiEvilOne opened 1 month ago

LokiEvilOne commented 1 month ago

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(), ); }, ),

rrousselGit commented 1 month ago

Without a complete example there's not much I can do.

LokiEvilOne commented 1 month ago

Screenshot 2024-04-08 172508 above attached image , i want to fetch the balance that time loading not working directly comes the value.

gdurandrexel commented 4 weeks ago

, i want to fetch the balance that time loading not working directly comes the value.

We would at least need the code of balanceProvider.