21 lines
450 B
Dart
21 lines
450 B
Dart
import 'dart:io' show Platform;
|
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
|
|
|
class PlatformService {
|
|
bool get isWeb => kIsWeb;
|
|
bool get isNative => !kIsWeb;
|
|
String get platformName => isWeb
|
|
? 'web'
|
|
: Platform.isAndroid
|
|
? 'android'
|
|
: Platform.isIOS
|
|
? 'ios'
|
|
: Platform.isWindows
|
|
? 'windows'
|
|
: Platform.isMacOS
|
|
? 'macos'
|
|
: Platform.isLinux
|
|
? 'linux'
|
|
: 'unknown';
|
|
}
|