Do you know how kIsWeb
is implemented in Flutter?
Here it is:
const bool kIsWeb = identical(0, 0.0);
Explanation:
- on web, Dart's doubles and ints are backed by the same kind of object (JS doesn't support integers)
- on the Dart VM, doubles and ints are different
Here's the official documentation:
Found this useful? Show some love and share the original tweet 🙏
Previous | Next |
---|---|
Explicit error types with Either | The HtmlUnescape package |