vendredi 11 octobre 2019

Tests don't work in Flutter Web application with Firebase plugin

I created Flutter Web application. I am using Firebase plugin. The application works in browser, but when I am trying to run tests I am getting compilation error related to Firebase plugin.

When I commented out the code related to Firebase plugin then a test is passing.

This is my pubspec.yaml:

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase: 5.0.4
  flutter_bloc: ^0.21.0
  meta: ^1.1.6

dev_dependencies:
  flutter_test:
    sdk: flutter

When I run tests I am getting:

Compiler message:
../../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/firebase-5.0.4/lib/src/utils.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html' show promiseToFuture;

So basically when running tests I don't have dart:html package imported. However when I start app normally everything works fine.

Can you help me with importing this package for tests?
Thank you :)

Aucun commentaire:

Enregistrer un commentaire