Skip to content

Latest commit

History

History
35 lines (20 loc) 路 825 Bytes

File metadata and controls

35 lines (20 loc) 路 825 Bytes

How kIsWeb works in Flutter

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