core_system library Core

Platform agnostic utilities for retrieving information about the current platform and microseconds since Unix epoch.

A System provides functions for retrieving the current platform's information. Unlike dart:io Platform, Runtime works on both native and web. The information includes the operating system name & version on native, and the browser information on web. The browser information may not be accurate since it is derived from the User-Agent header.

To retrieve the current platform:

// Assuming that the current platform is Android.
print(const System().android); true
print(const System().web); false

To retrieve the current microseconds since Unix epoch:

// Assuming that the current microseconds since Unix epoch is 1000.
print(System.epochMicroseconds); // 1000

A FakeSystem is also provided for testing.

print(const FakeSystem(PlatformType.android).android); true
print(const FakeSystem(PlatformType.android).web); false

Classes

FakeSystem
Creates a FakeSystem for testing.
System
Provides a platform agnostic way to retrieve information about the system.

Enums

PlatformType
The platform's type.