Artigo - How to use defaultTargetPlatform and kIsWeb
-
Artigo - How to use defaultTargetPlatform and kIsWeb
-
If your code checks the current platform with Platform.isIOS, you’ll get a runtime exception when you run on Flutter web. 💥
To prevent this, check for kIsWeb beforehand and use it together with defaultTargetPlatform, which doesn't import dart:io. 👍
