Open rydmike opened 3 years ago
@Hixie Are there APIs that would make sense for us to flag?
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.
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: https://github.com/dart-lang/sdk/issues/44876