A generic platform abstraction for Dart.
package:platform supplies a rich, Dart-idiomatic API for
accessing platform-specific information.
package:platform provides a lightweight wrapper around the static
properties that exist in
dart:io. However, it uses instance properties rather
than static properties, making it possible to mock out in tests.
- Declare compatibility with Dart 2 stable
- Update dependency on
- Relax sdk upper bound constraint to '<2.0.0' to allow 'edge' dart sdk use.
- Bumped maximum Dart SDK version to 2.0.0-dev.infinity
- Bumped minimum Dart SDK version to 1.24.0-dev.0.0
LocalPlatformto use new
dart.ioAPI for ansi color support queries
- Bumped minimum Dart SDK version to 1.23.0-dev.10.0
- Bumped minimum Dart SDK version to 1.23.0-dev.9.0
- Minor doc updates
- Added const constructors for
- Initial version
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: platform: ^2.2.1
2. Install it
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.6.0
- pana: 0.12.21
Detected platforms: Flutter, other
lib/src/testing/fake_platform.dart. (-1.99 points)
lib/src/testing/fake_platform.dart reported 4 hints:
line 42 col 23: Unnecessary new keyword.
line 47 col 13: Unnecessary new keyword.
line 61 col 32: Unnecessary new keyword.
line 62 col 12: Unnecessary new keyword.
lib/src/interface/local_platform.dart. (-0.50 points)
lib/src/interface/local_platform.dart reported 1 hint:
line 45 col 41: 'packageRoot' is deprecated and shouldn't be used. packages/ directory resolution is not supported in Dart 2.
Maintenance issues and suggestions
analysis_options.yaml. (-10 points)
Change the name of your package's
.analysis_options file to
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
platform.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
The package description is too short. (-8 points)
Add more detail to the
description field of
pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.
|Dart SDK||>=1.24.0-dev.0.0 <3.0.0|