mplatform 0.0.1 copy "mplatform: ^0.0.1" to clipboard
mplatform: ^0.0.1 copied to clipboard

retractedoutdated

A flutter package that makes it easy to handle platform checking

Mplatform #

Literally the whole package

enum Mplatform {
  android,
  web,
  ios,
  macos,
  windows,
  linux,
  fuchsia;

  static Mplatform get current {
    if (kIsWeb) {
      return Mplatform.web;
    } else {
      switch (defaultTargetPlatform) {
        case TargetPlatform.android:
          return Mplatform.android;
        case TargetPlatform.fuchsia:
          return Mplatform.fuchsia;
        case TargetPlatform.iOS:
          return Mplatform.ios;
        case TargetPlatform.linux:
          return Mplatform.linux;
        case TargetPlatform.macOS:
          return Mplatform.macos;
        case TargetPlatform.windows:
          return Mplatform.windows;
      }
    }
  }

  static bool isWeb() {
    return current == web;
  }

  static bool isAndroid() {
    return current == android;
  }

  static bool isIos() {
    return current == ios;
  }

  static bool isMacOs() {
    return current == macos;
  }

  static bool isWindows() {
    return current == windows;
  }

  static bool isLinux() {
    return current == linux;
  }

  static bool isFuchsia() {
    return current == fuchsia;
  }
}
2
likes
0
points
25
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter package that makes it easy to handle platform checking

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on mplatform