Skip to content
pubscout

universal_platform

1.1.0, released 2 years ago by gskinner.com

Platform detection across Flutter, Dart web, and desktop without errors

WASM-ready
$ flutter pub add universal_platform
Source repository

What it does

UniversalPlatform replaces dart.io.Platform to provide safe platform checks on Web, Android, iOS, macOS, Windows, and Linux. It exposes boolean getters like isIOS, isWeb, and desktopOrWeb.

AI-written summary of version 1.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to perform platform checks in your view or model layers
  • Your app targets Web and you want to avoid UnsupportedOperation errors
  • You want a single API for all supported platforms

Skip it when

  • You only target native mobile and can use dart.io.Platform safely
  • You need more advanced platform-specific APIs beyond simple checks

Strengths

  • No dependencies, lightweight
  • Works on all supported platforms including Web
  • Simple boolean API

Weaknesses

  • Only provides platform checks, no other utilities
  • No support for platform-specific APIs beyond booleans

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:universal_platform/universal_platform.dart';

bool isIos = UniversalPlatform.isIOS;
bool isWeb = UniversalPlatform.isWeb;

Alternatives

Packages that do the same job and could replace universal_platform.

  • wasm_ffi

    Drop-in replacement for dart:ffi for WebAssembly on the web platform.

  • dbcrypt

    A Dart port of jBCrypt for hashing and checking passwords with a configurable work factor.

  • isoweek

    Lightweight Dart package providing the Week class based on the ISO 8601 format.

  • launcher_icon_switcher

    Dynamically switch app launcher icons on Android and iOS.

Works with

Packages commonly used together with universal_platform: ones it builds on, ones built on it, and its own family.