How to unit test Riverpod StateNotifier using ProviderContainer

Viewed 212

I want to test Riverpod StateNotifierProvider. I'm trying to follow a TDD approach for state notifier providers without implementing UI/Widgets.

According to Riverpod documentation on testing, can use ProviderContainer for testing without Widget test. But it doesn't work the way I want.

Scenario : When call function in the provider several state changes happen in order.

Objective : Track all states. Ensure all state changes are in the correct order.

My question :

What's the best way to test these StateNotifierProvider state changes without implementing UI/Widget.

0 Answers
Related