Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if certain APIs are being used in a way that produce different results on VM and Web builds #2447

Open
rydmike opened this issue Feb 8, 2021 · 2 comments
Labels
lint-request type-enhancement A request for a change that isn't a bug

Comments

@rydmike
Copy link

rydmike commented Feb 8, 2021

Linter rationale and background

Flutter makes cross platform development between VM and Web mainstream. Developers are thus more likely to run across APIs that while they work and are available on both platforms, might in some use-cases produce different results due to underlying implementation differences.

A linter rule that can detect usage of such APIs and use cases, and warn about the risk or issue, can help to avoid such errors and time consuming debugging.

Flutter code that was originally written to only consider VM builds, might later when built for Web as well, inadvertently use such APIs in such ways without the original use case being aware of the limitations in the Web platform. Such errors can be difficult to debug and find in the built Flutter web application.

Rule scope

The rule scope is general purpose for cross platform builds, but certainly driven by Flutter making it mainstream.

Example

An example of a case that occurred due to API's underlying implementation details differences in VM and Web was posted in this issue: dart-lang/sdk#44876

@bwilkerson
Copy link
Member

@Hixie Are there APIs that would make sense for us to flag?

@Hixie
Copy link

Hixie commented Feb 9, 2021

The only cases I'm aware of are doubles vs ints, how deferred library loading works, the platform-specific libraries (dart:io, dart:html, dart:js, dart:cli, etc), and Flutter plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lint-request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants