Skip to content

Figure out which "operatingSystem" Wasm is. #4

Open
@lrhn

Description

@lrhn

The current Platform.operatingSystem implementation in the new version of this package
uses Platform.operatingSystem for native and "browser" for Web.

That doesn't exhaust our platforms any more (and arguably didn't before).

When compiled to non-web JS and run on Node, it's incorrect to say that the operating system is "browser", even if dart:js is available (which is what it's currently triggering on).
But dart:io isn't available, so we also cannot use Platform.operatingSystem.

With Wasm compilation, that gets more complicated, since we can have Wasm running on different operating systems and in a browser, and we can't really tell.
And running in a non-browser Wasm runtime, doesn't mean that dart:io is available.

We should probably use Platform.operatingSystem from dart:io if it is available.
If not, we should ... try to figure out whether it's a browser (use dart:html as signifier, or can that be wrong too, if someone embeds a Dart VM into a platform with HTML display, but which isn't a full browser?

And for Wasm compiled code, we should see if there is some hint to the operating system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions