accessing rootBundle in flutter unit test accessing rootBundle in flutter unit test dart dart

accessing rootBundle in flutter unit test


Add this line as the first to be executed in your test and it will work and load the assets:

TestWidgetsFlutterBinding.ensureInitialized();

It will initialise everything before running your code and the assets will be accessible at that point.