I want to run a unit test that covers both possible cases, web and non-web deployment. The code for the class to be tested basically looks like this:
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (kIsWeb) {
return Text("I'm web");
} else {
return Text("I'm not web");
}
}
}
kIsWeb
is a constant provided by Dart that determines if the application was compiled to run on the web.
My current test class implementation is only able to test the non-web path. Is there a way to create a test for the case of kIsWeb == true
?
Aucun commentaire:
Enregistrer un commentaire