dartlangeditorflutterflutter-appsflutter-examplesflutter-packageflutter-widgetquillquill-deltaquilljsreactquillrich-textrich-text-editorwysiwygwysiwyg-editor
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
import 'dart:io'; |
|
|
|
import 'package:device_info_plus/device_info_plus.dart'; |
|
import 'package:flutter/foundation.dart'; |
|
|
|
bool isMobile([TargetPlatform? targetPlatform]) { |
|
targetPlatform ??= defaultTargetPlatform; |
|
return {TargetPlatform.iOS, TargetPlatform.android}.contains(targetPlatform); |
|
} |
|
|
|
bool isDesktop([TargetPlatform? targetPlatform]) { |
|
targetPlatform ??= defaultTargetPlatform; |
|
return {TargetPlatform.macOS, TargetPlatform.linux, TargetPlatform.windows} |
|
.contains(targetPlatform); |
|
} |
|
|
|
bool isKeyboardOS([TargetPlatform? targetPlatform]) { |
|
targetPlatform ??= defaultTargetPlatform; |
|
return isDesktop(targetPlatform) || targetPlatform == TargetPlatform.fuchsia; |
|
} |
|
|
|
bool isAppleOS([TargetPlatform? targetPlatform]) { |
|
targetPlatform ??= defaultTargetPlatform; |
|
return { |
|
TargetPlatform.macOS, |
|
TargetPlatform.iOS, |
|
}.contains(targetPlatform); |
|
} |
|
|
|
Future<bool> isIOSSimulator() async { |
|
if (Platform.isIOS) { |
|
final deviceInfo = DeviceInfoPlugin(); |
|
final iosInfo = await deviceInfo.iosInfo; |
|
return !iosInfo.isPhysicalDevice; |
|
} |
|
return false; |
|
}
|
|
|