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.

Source code :
https://github.com/AseemWangoo/flutter_programs/blob/master/providers_test.zip

#flutter #testing #programming #developer

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