flutter_bk_ua

Last updated:

0 purchases

flutter_bk_ua Image
flutter_bk_ua Images
Add to Cart

Description:

flutter bk ua

flutter_bk_ua #
get device info
Getting Started #
This project is a starting point for a Flutter
plug-in package,
a specialized package that includes platform-specific implementation code for
Android and/or iOS.
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Installation #


This plugin is set the Null Safety.


Add this to your package's pubspec.yaml file


dependencies:
flutter_bk_ua: ^1.x.x
copied to clipboard

You can install packages from the command line

$ flutter pub get
copied to clipboard
Usage #
With Dio #
Add to the request header.
class AppDio with DioMixin implements Dio {
AppDio._([BaseOptions options]) {
options = BaseOptions(
baseUrl: '/api',
);

this.options = options;
interceptors.add(InterceptorsWrapper(
onRequest: (options) async {
// Add User-Agent Client
options.headers['X-PLATFORM'] = await FlutterBkUA.getUserAgent.platform;
return options;
},
));
}

static Dio getInstance() => AppDio._();
}
copied to clipboard
APIs #
final UAModel ua = await getUserAgent();

print('User-Agent: ${ua.toJSON()}');
final String uaHeader = getUAHeader()
print('platform: ${ua.platform}'); // e.g. 'iOS'
print('platformVersion: ${ua.platformVersion}'); // e.g. '15.2'
print('model: ${ua.model}'); // e.g. 'iphone'
print('architecture: ${ua.architecture}'); // e.g. 'arm64'
print('mobile: ${ua.mobile}'); // e.g. true
print('device: ${ua.device}'); // e.g. 'iphone 12 pro'
print('appName: ${ua.appName}'); // e.g. 'SampleApp'
print('appVersion: ${ua.appVersion}'); // e.g. '1.0.0'
print('packageName: ${ua.packageName}'); // e.g. 'com.xxxx'
print('User-agent: $uaHeader'); // e.g. 'SampleApp;com.xxx;1.0.0;iphone12 pro;iOS 15.2'
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.