Reapply 3.2 version of package:platform with changes (#958) Reapplies 0def20c4bef2b242db15b38202a54735101f5791 Completely new API which is cross-platform safe to use. The `Platform.current` object exposes one (or potentially more) of a `NativePlatform` (based on `dart:io`) or `BrowserPlatform` (based on JS `window.navigator` or anything else relevant). Currently no `Platform.wasm` or similar, but if a useful way to recognize it is introduced, one can be added. Each has its own API, and the current platform determines whether a value of these types is available or not. On unsupported platforms, a value is just `null`. Provides a `testing.dart` library which exposes `TestNativePlatform` and `TestBrowserPlatform`, which are customizable classes that can be used for testing. It's possible to run code with such a fake value as the *current* platform (`Platform.current` is temporarily updated to a value which exposes the, fx, `TestNativePlatform` as its `Platform.nativePlatform`). Still retains the legacy and deprecated API that makes native properties directly available on `Platform`. Code should migrate to the new API by doing: * `const LocalPlatform()` → `Platform.current.nativePlatform!` * `new FakePlatform()` → `new TestNativePlatform()` It's currently not possible to have more than one non-`null` platform-value. Platforms are detected by the presence of the `dart:io` and `dart:js_interop` libraries, and no current platform has both. When such a platform exists, the code will need to be adapted to to produce *both* (possible using conditional imports or conditional parts and augmentations). Updates from the original: Split into abstract interface and config-imported implementation. This should allow, for example, code-generators to refer to the library of the public types uniformly across platforms. Make `Platform.is<OS>` operations work on legacy `FakePlatform`. Requires importing some testing classes into the main library, which is not surprising when the legacy `FakePlatform` class existed for testing to begin with.
This repository is home to various Dart packages under the dart.dev publisher.
| Package | Description | Issues | Version |
|---|---|---|---|
| args | Library for defining parsers for parsing raw command-line arguments into a set of options and values using GNU and POSIX style options. | ||
| async | Utility functions and classes related to the ‘dart:async’ library. | ||
| characters | String replacement with operations that are Unicode/grapheme cluster aware. | ||
| collection | Collections and utilities functions and classes related to collections. | ||
| convert | Utilities for converting between data representations. Provides a number of Sink, Codec, Decoder, and Encoder types. | ||
| crypto | Implementations of SHA, MD5, and HMAC cryptographic functions. | ||
| fixnum | Library for 32- and 64-bit signed fixed-width integers with consistent behavior between native and JS runtimes. | ||
| lints | Official Dart lint rules. Defines the ‘core’ and ‘recommended’ set of lints suggested by the Dart team. | ||
| logging | Provides APIs for debugging and error logging, similar to loggers in other languages, such as the Closure JS Logger and java.util.logging.Logger. | ||
| os_detect | Platform independent OS detection. | ||
| path | A string-based path manipulation library. | ||
| platform | A pluggable, mockable platform information abstraction for Dart. | ||
| typed_data | Utility functions and classes related to the dart:typed_data library. |
For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.
For additional information about contributing, see our contributing page.