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.


  1. This plugin is set the Null Safety.

  2. Add this to your package's pubspec.yaml file

  flutter_bk_ua: ^1.x.x
  1. You can install packages from the command line
$ flutter pub get


With Dio

Add to the request header.

class AppDio with DioMixin implements Dio {
  AppDio._([BaseOptions options]) {
    options = BaseOptions(
      baseUrl: '/api',

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

  static Dio getInstance() => AppDio._();


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'