lrhn / platform.dart

A generic platform abstraction for Dart
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Split API into cross-platform OS-detection and native-only Platform i… #2

Open lrhn opened 1 year ago

lrhn commented 1 year ago

The cross-platform OS detection is in package:platform/host.dart, in the HostPlatform class. The native-only platform inspection in package:platform/native.dart in the NativePlatform class.

There are also package:platform/host_test.dart, and package:platform/native_test.dart, which provides a mock for each of the platform classes, MockHostPlatform and MockNativePlatform.

Existing code can keep importing package:platform/platform.dart, which exports the host.dart library, but also type-aliases for native-capable platforms to match the existing Platform, FakePlatform and LocalPlatform names. Those legacy names will eventually be deprecated.