get_settings 1.0.6 get_settings: ^1.0.6 copied to clipboard
Toolbox, some useful methods, not commonly used but indispensable
Get Settings #
Toolbox, some useful methods, not commonly used but indispensable
Support #
Method | IOS Support | Android Support |
---|---|---|
getPlatformVersion | ✅ | ✅ |
isiOSAppOnMac | ✅ | ❌ |
getUserAgent | ✅ | ✅ |
isRotationOn | ❌ | ✅ |
getCPUType | ✅ | ❌ |
isPad | ✅ | ✅ |
ipodToPath | ✅ | ❌ |
contentToPath | ❌ | ✅ |
Usage #
import 'package:get_settings/getsettings.dart';
final setting = GetSettings();
Uri to file #
Use on_audio_query to obtain the uri of the audio file. This method can obtain the absolute path of the file.
content://
to filepath , app cache dir, Android Only.ipod-library
to filepath, app document dir, IOS Only.
Android:
Future<String> ipodPath = await setting.ipodToPath('ipod-library://item/item.mp3?id=6894390456987001162');
print(ipodPath);
Future<String> contentPath = await setting.contentToPath('content://media/external/audio/media/1000000346');
print(ipodpath);
Rotation On #
Android Only
setting.onListenSettings((rotation) {
print(rotation);
}, (onError) {
print('error:$onError');
});
Future<bool?> isRotationOn =await setting.isRotationOn();
Platform Version #
Future<String?> getPlatformVersion =await setting.getPlatformVersion();
print(getPlatformVersion);
iOS App On Mac #
Particularly useful for detecting whether an app is running on macOS, IOS Only
Future<bool?> isiOSAppOnMac =await setting.isiOSAppOnMac();
print(isiOSAppOnMac);
User Agent #
webview UserAgent
Future<String?> getUserAgent =await setting.getUserAgent();
print(getUserAgent);
CPU type #
IOS Only
Future<String?> getCPUType =await setting.getCPUType();
print(getCPUType);
//ARM,ARM64,X86,X86_64