fix lint
This commit is contained in:
@@ -2,26 +2,56 @@ import 'platform_detector_stub.dart'
|
||||
if (dart.library.html) 'platform_detector_web.dart'
|
||||
if (dart.library.io) 'platform_detector_io.dart';
|
||||
|
||||
/// Possible platforms
|
||||
enum PlatformType {
|
||||
///
|
||||
Android,
|
||||
|
||||
///
|
||||
Ios,
|
||||
|
||||
///
|
||||
Web,
|
||||
|
||||
///
|
||||
MacOS,
|
||||
|
||||
///
|
||||
Windows,
|
||||
|
||||
///
|
||||
Linux,
|
||||
|
||||
///
|
||||
Fuchsia,
|
||||
}
|
||||
|
||||
/// Utility class that provides information on the current platform
|
||||
class CurrentPlatform {
|
||||
CurrentPlatform._();
|
||||
|
||||
/// True if the app is running on android
|
||||
static bool get isAndroid => type == PlatformType.Android;
|
||||
|
||||
/// True if the app is running on ios
|
||||
static bool get isIos => type == PlatformType.Ios;
|
||||
|
||||
/// True if the app is running on web
|
||||
static bool get isWeb => type == PlatformType.Web;
|
||||
|
||||
/// True if the app is running on macos
|
||||
static bool get isMacOS => type == PlatformType.MacOS;
|
||||
|
||||
/// True if the app is running on windows
|
||||
static bool get isWindows => type == PlatformType.Windows;
|
||||
|
||||
/// True if the app is running on linux
|
||||
static bool get isLinux => type == PlatformType.Linux;
|
||||
|
||||
/// True if the app is running on fuchsia
|
||||
static bool get isFuchsia => type == PlatformType.Fuchsia;
|
||||
|
||||
/// Returns a string version of the platform
|
||||
static String get name {
|
||||
switch (type) {
|
||||
case PlatformType.Android:
|
||||
@@ -43,5 +73,6 @@ class CurrentPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get current platform type
|
||||
static PlatformType get type => currentPlatform;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
import 'platform_detector.dart';
|
||||
|
||||
/// Version running on native systems
|
||||
PlatformType get currentPlatform {
|
||||
if (Platform.isWindows) return PlatformType.Windows;
|
||||
if (Platform.isFuchsia) return PlatformType.Fuchsia;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'platform_detector.dart';
|
||||
|
||||
/// Stub implementation
|
||||
PlatformType get currentPlatform {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'platform_detector.dart';
|
||||
|
||||
/// Version running on web
|
||||
PlatformType get currentPlatform => PlatformType.Web;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
|
||||
Reference in New Issue
Block a user