Testing Provider in Flutter | Unit/Widget test cases for provider |Unit testing Provider

Опубликовано: 12 Октябрь 2024
на канале: aseem wangoo
3,279
18

This video demonstrates how to write test cases (unit or widget) for provider package...

Testing Provider in Flutter | Unit/Widget test cases for provider *
Pre-requisite : Install build_runner, json_serializable and json_annotation….
Note: Please place the packages as advised in the respective links. Also, you need to be in flutter channel: stable and version: Flutter 1.9.1+hotfix.6

1. Create a Model class…We have created a simple model class called Location….
Next, we will use the flutter generator to create a generated file….by running flutter pub run build_runner build --delete-conflicting-outputs. This generates location.g.dart file….

All tests for flutter should be placed in the test folder (generated by default for every project..) According to Flutter Documentation :
A unit test tests a single function, method, or class. The goal of a unit test is to verify the correctness of a unit of logic under a variety of conditions.

Website: https://flatteredwithflutter.com/test...

Medium:   / testing-provider-in-flutter  

Source code :
https://github.com/AseemWangoo/flutte...

In case, this helped, pass me a coffee!! 😊😊
https://www.buymeacoffee.com/aseemwangoo

#flutter #provider #testing