isweb_test 1.0.0 isweb_test: ^1.0.0 copied to clipboard
Defines a function for allowing to do tests on web. The package test_screen uses it to emulate a web environment for testing and allow run tests on Windows, Linux or Mac.
isWeb_test #
On Flutter 3.x exist the global variable kIsWeb
indicating than the application was compiled to run on the web.
On multi platform applications this variable could be used for adapting UI to the different platforms, but, doesn't exist an override for doing test. So, when a test is running, kIsWeb is always false, because the platform that is running the tests is Linux, Windows or Mac.
This packages defines the global variable debugIsWeb
and the function isWeb()
. On your code, using the function isWeb()
instead of kIwWeb
, give you the possibility to run tests and emulate the web environment with debugIsWeb
.
The package test_screen uses it for doing web tests.
Usage #
@override
Widget build(BuildContext context) {
return isWeb()
? _webSlider()
: _defaultSlider();
}