-
Notifications
You must be signed in to change notification settings - Fork 0
Create migration-guide.md #3
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good! Nits on phrasings.
migration-guide.md
Outdated
## From `dart:io` | ||
|
||
The `dart:io` core library is a special custom library only available on Dart | ||
native platforms (and for example, not available on Dart web platforms). We |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make a newline before "We", to make reading the source easier. (Semantic line-breaks FTW!)
migration-guide.md
Outdated
```dart | ||
import 'package:platform/platform.dart'; // version 4.x | ||
|
||
bool onAndroid = Platform.current.isAndroid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should actually be
import 'package:platform/host.dart';
bool onAndroid = HostPlatform.current.isAndroid;
The platform.dart
library is not cross-platform capable, it's there for backwards compatibility with v3, where platform.dart
allowed access to native-only features.
So, the question is whether this is a minimal migration guide or a full migration guide.
The migration shown here is the minimal needed to preserve the current behavior, including the dependency on dart:io
.
The one I wrote above is the ultimate migration, to cross-platform compatible code.
Which one do we want? Both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like it if we could do the full migration to HostPlatform
, but whether that is realistic I think depends on whether dart fix
can automate the migration. I'm going to share this page with the analyzer team to get their input.
Can we merge @lrhn (this is your repo, so I can't do it) ? |
One last fix.
No description provided.