All Projects → PlugFox → platform_info

PlugFox / platform_info

Licence: WTFPL license
Containts info about current platform such as Build mode and Operating system

Programming Languages

dart
5743 projects
Makefile
30231 projects

Projects that are alternatives of or similar to platform info

FlutterFlare-Basic
Flare 2D Dimension.
Stars: ✭ 24 (+14.29%)
Mutual labels:  angulardart
fimage
Portable Fuchsia Emulator
Stars: ✭ 264 (+1157.14%)
Mutual labels:  fuchsia
flutter base
实现一套代码,2种风格,ios使用Cupertino风格组件,andriod、fuchsia使用Material风格组件
Stars: ✭ 23 (+9.52%)
Mutual labels:  cupertino
glips
screen clip to gif on web
Stars: ✭ 18 (-14.29%)
Mutual labels:  angulardart
Bloc
A predictable state management library that helps implement the BLoC design pattern
Stars: ✭ 8,214 (+39014.29%)
Mutual labels:  angulardart
Flutter
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Stars: ✭ 133,413 (+635200%)
Mutual labels:  fuchsia
FlutterLoadingGIFs
Loading indicator GIFs. Material and Cupertino (Android and iOS) loading indicators in assorted sizes. Use as placeholders for loading remote image assets. Demo: https://gallery.codelessly.com/flutterwebsites/loadinggifs/
Stars: ✭ 28 (+33.33%)
Mutual labels:  cupertino
keyboard
A terrible terrible soft-keyboard that randomises keys on every press.
Stars: ✭ 17 (-19.05%)
Mutual labels:  wtfpl
Angular
Fast and productive web framework provided by Dart
Stars: ✭ 1,817 (+8552.38%)
Mutual labels:  angulardart
what-to-eat
🍴 A useful tool helps you deciding what to eat for lunch.
Stars: ✭ 19 (-9.52%)
Mutual labels:  wtfpl
angular cli
No description or website provided.
Stars: ✭ 64 (+204.76%)
Mutual labels:  angulardart
Inkino
A multiplatform Dart movie app with 40% of code sharing between Flutter and the Web.
Stars: ✭ 3,229 (+15276.19%)
Mutual labels:  angulardart
zzlib
zlib-compressed file depacking library in Lua
Stars: ✭ 44 (+109.52%)
Mutual labels:  wtfpl
parse server dart
Parse Server SDK for dart and flutter
Stars: ✭ 25 (+19.05%)
Mutual labels:  angulardart
sponge
sponge is a website crawler and links downloader command-line tool
Stars: ✭ 37 (+76.19%)
Mutual labels:  wtfpl
flutter date picker
A Cupertino style date picker for Android and IOS
Stars: ✭ 78 (+271.43%)
Mutual labels:  cupertino
Fuchsia
Google Fuchsia theme (based on preview colors and Android theme)
Stars: ✭ 15 (-28.57%)
Mutual labels:  fuchsia
angular quill
Angular dart component for the Quill rich text editor
Stars: ✭ 22 (+4.76%)
Mutual labels:  angulardart
flutter spinbox
Material & Cupertino SpinBox for Flutter
Stars: ✭ 26 (+23.81%)
Mutual labels:  cupertino
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (+23.81%)
Mutual labels:  wtfpl

platform_info

platform_info Actions Status Coverage License: WTFPL Linter

About

Cross-platform io/html package.
Works on the web, mobile phones, desktops and console.
Fully caches itself on first initialization.

Easy to use, just add to pubspec.yaml as dependency and then import:
import 'package:platform_info/platform_info.dart';

Platform is a singleton, and the default way to access an instance of Platform is to call static getters:
Platform.instance or Platform.I or platform

Platform Information

Provides platform information such as:

  • Build mode

    • release
    • profile
    • debug
  • Host platform type

    • io (vm, desktops, mobile, console)
    • web (html, js, browser)
  • Operating system

    • Fuchsia
    • Linux
    • MacOS
    • Windows
    • iOS
    • Android
    • Unknown
  • Version (<unknown> if not available)

  • Locale string (en if not available)

  • The number of individual execution units of the machine (0 if not available)

  • Operating system is a known type

  • Is a Web-based applications

  • Is a I/O supporting for non-web applications

  • Is a mobile device (Android, iOS)

  • Is a desktop device (Windows, macOS, Fuchsia)

  • Is Material design device (Android, Fuchsia)

  • Is Cupertino design device (macOS, iOS)

  • is Linux

  • is macOS

  • is Windows

  • is android

  • is iOS

  • is fuchsia

  • when method allowing to compose a complex condition

platform.when

Run functions that satisfy the current state of the platform.
You can use nested methods to compose more complex queries.

Operating System

[fuchsia] - whether the operating system is a version of Fuchsia
[windows] - whether the operating system is a version of Windows
[android] - whether the operating system is a version of Android
[iOS] - whether the operating system is a version of iOS
[macOS] - whether the operating system is a version of MacOS
[linux] - whether the operating system is a version of Linux
[unknown] - operating system unknown

Design

[material] - is material (Android, Fuchsia)
[cupertino] - is cupertino (macOS, iOS)

Mobile or desktop

[mobile] - is mobile device (Android, iOS)
[desktop] - is desktop device (Windows, MacOS, Fuchsia)

IO or Web

[web] - is web-based applications
[io] - is I/O supporting for non-web applications

Build mode

[release] - release build mode
[profile] - profile build mode
[debug] - debug build mode
[orElse] - any callback was not called

Sequence of checks
  1. Operating System
  2. Design
  3. Mobile/Desktop
  4. IO/Web
  5. Build mode
  6. Call [orElse] if any callback was not called

For example

import 'package:platform_info/platform_info.dart';

void main(List<String> args) {
  // Use [Platform.instance] or [Platform.I] or [platform] getter
  print(Platform.instance.version);
  print(Platform.I.operatingSystem);
  print(platform.numberOfProcessors.gcd(1));

  final string = platform.when(
    io: () => platform.when(
      fuchsia:   () => 'io fuchsia',
      windows:   () => 'io windows',
      android:   () => 'io android',
      iOS:       () => 'io iOS',
      macOS:     () => 'io macOS',
      linux:     () => 'io linux',
      unknown:   () => 'io unknown',
    ),
    web: () => platform.when(
      material:  () => 'web Android or Fuchsia',
      cupertino: () => 'web macOS or iOS',
      orElse:    () => 'web Windows or Linux or unknown',
    ),
  );
  print(string);
}

Coverage

Changelog

Refer to the Changelog to get all release notes.

Maintainers

Plague Fox

License

WTFPL

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].