{"id":16426769,"url":"https://github.com/wasabeef/flutter_ua_client_hints","last_synced_at":"2025-04-06T02:12:38.752Z","repository":{"id":38000526,"uuid":"317601002","full_name":"wasabeef/flutter_ua_client_hints","owner":"wasabeef","description":"Provide User-Agent Client Hints to a Flutter app.","archived":false,"fork":false,"pushed_at":"2025-03-24T22:07:48.000Z","size":808,"stargazers_count":47,"open_issues_count":12,"forks_count":24,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T01:13:09.066Z","etag":null,"topics":["android","dart","flutter","ios","useragent"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wasabeef.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"wasabeef","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-12-01T16:26:17.000Z","updated_at":"2025-03-11T11:25:19.000Z","dependencies_parsed_at":"2024-06-19T19:03:24.701Z","dependency_job_id":"201f720e-799b-465a-b704-4ae93a20425c","html_url":"https://github.com/wasabeef/flutter_ua_client_hints","commit_stats":{"total_commits":119,"total_committers":10,"mean_commits":11.9,"dds":"0.26050420168067223","last_synced_commit":"d2284e05ea8eccee927d9419642214ec349136b0"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fflutter_ua_client_hints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fflutter_ua_client_hints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fflutter_ua_client_hints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasabeef%2Fflutter_ua_client_hints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wasabeef","download_url":"https://codeload.github.com/wasabeef/flutter_ua_client_hints/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423516,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dart","flutter","ios","useragent"],"created_at":"2024-10-11T08:10:17.106Z","updated_at":"2025-04-06T02:12:38.735Z","avatar_url":"https://github.com/wasabeef.png","language":"Dart","funding_links":["https://github.com/sponsors/wasabeef"],"categories":[],"sub_categories":[],"readme":"# [User-Agent Client Hints for Flutter](https://pub.dev/packages/ua_client_hints)\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pub.dev/packages/ua_client_hints\"\u003e\n    \u003cimg src=\"https://github.com/wasabeef/flutter_ua_client_hints/raw/main/art/ua_client_hints.png\" width=\"100%/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pub.dev/packages/ua_client_hints\"\u003e\u003cimg src=\"https://img.shields.io/pub/v/ua_client_hints.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/wasabeef/flutter_ua_client_hints/actions\"\u003e\u003cimg src=\"https://github.com/wasabeef/flutter_ua_client_hints/actions/workflows/build.yml/badge.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pub.dev/packages/effective_dart\"\u003e\u003cimg src=\"https://img.shields.io/badge/style-effective_dart-40c4ff.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n                                                                           \n\n## What's User-Agent Client Hints?\n\n[User-Agent Client Hints](https://wicg.github.io/ua-client-hints/)  \n[Improving user privacy and developer experience with User-Agent Client Hints](https://web.dev/user-agent-client-hints/)  \n[User-Agent Client Hints Demo on Browser](https://user-agent-client-hints.glitch.me/?uach=UA-Arch\u0026uach=UA-Full-Version\u0026uach=UA-Mobile\u0026uach=UA-Model\u0026uach=UA-Platform-Version\u0026uach=UA-Platform\u0026uach=UA)  \n\n|⬇️ Response Accept-CH|⬆️ Request header|⬆️ RequestExample value|Description|\n|--|--|--|--|\n|UA|Sec-CH-UA|\"Chromium\";v=\"84\",\u003cbr\u003e\"Google Chrome\";v=\"84\"|List of browser brands and their significant version.|\n|UA-Mobile|Sec-CH-UA-Mobile|?1|Boolean indicating if the browser is \u003cbr\u003eon a mobile device (?1 for true) or not (?0 for false).|\n|UA-Full-Version|Sec-CH-UA-Full-Version|\"84.0.4143.2\"|The complete version for the browser.|\n|UA-Platform|Sec-CH-UA-Platform|\"Android\"|The platform for the device,\u003cbr\u003eusually the operating system (OS).|\n|UA-Platform-Version|Sec-CH-UA-Platform-Version|\"10\"|The version for the platform or OS.|\n|UA-Arch|Sec-CH-UA-Arch|\"ARM64\"|The underlying architecture for the device.\u003cbr\u003eWhile this may not be relevant to displaying the page,\u003cbr\u003ethe site may want to offer a download which defaults to the right format.|\n|UA-Model|Sec-CH-UA-Model|\"Pixel 3\"|The device model.|\n\n## [Installation](https://pub.dev/packages/ua_client_hints)\n\nThis plugin is set the [Null Safety](https://flutter.dev/docs/null-safety).\n\nAdd this to your package's `pubspec.yaml` file by running the following command\n\n```shell\n$ flutter pub add ua_client_hints\n```\n\n## Usage\n\n### With [Dio](https://pub.dev/packages/dio)\n\nAdd to the request header.\n```dart\nclass AppDio with DioMixin implements Dio {\n  AppDio._([BaseOptions options]) {\n    options = BaseOptions(\n      baseUrl: 'https://wasabeef.jp',\n    );\n\n    this.options = options;\n    interceptors.add(InterceptorsWrapper(\n      onRequest: (options) async {\n        // Add User-Agent Client Hints\n        options.headers.addAll(await userAgentClientHintsHeader());\n        return options;\n      },\n    ));\n  }\n\n  static Dio getInstance() =\u003e AppDio._();\n}\n```\n\n### APIs\n```dart\nfinal String ua = await userAgent();\n\nprint('User-Agent: $ua');  // e.g.. 'SampleApp/1.0.0 (Android 11; Pixel 4 XL; coral; arm64-v8a)'\n```\n\n```dart\nfinal UserAgentData uaData = await userAgentData();\n\nprint('platform:        ${uaData.platform}');              // e.g.. 'Android'\nprint('platformVersion: ${uaData.platformVersion}');       // e.g.. '10'\nprint('model:           ${uaData.model}');                 // e.g.. 'Pixel 4 XL'\nprint('architecture:    ${uaData.architecture}');          // e.g.. 'arm64-v8a'\nprint('brand:           ${uaData.brand}');                 // e.g.. 'Google'\nprint('mobile:          ${uaData.mobile}');                // e.g.. true\nprint('device:          ${uaData.device}');                // e.g.. 'coral'\nprint('appName:         ${uaData.package.appName}');       // e.g.. 'SampleApp'\nprint('appVersion:      ${uaData.package.appVersion}');    // e.g.. '1.0.0'\nprint('packageName:     ${uaData.package.packageName}');   // e.g.. 'jp.wasabeef.ua'\nprint('buildNumber:     ${uaData.package.buildNumber}');   // e.g.. '1'\n```\n\n```dart\nfinal Map\u003cString, dynamic\u003e header = await userAgentClientHintsHeader();\n\nprint(\"Sec-CH-UA-Arch:             ${header['Sec-CH-UA-Arch']}\");             // e.g.. 'arm64-v8a'\nprint(\"Sec-CH-UA-Model:            ${header['Sec-CH-UA-Model']}\");            // e.g.. 'Pixel 4 XL'\nprint(\"Sec-CH-UA-Platform:         ${header['Sec-CH-UA-Platform']}\");         // e.g.. 'Android'\nprint(\"Sec-CH-UA-Platform-Version: ${header['Sec-CH-UA-Platform-Version']}\"); // e.g.. '10'\nprint(\"Sec-CH-UA:                  ${header['Sec-CH-UA']}\");                  // e.g.. '\"SampleApp\"; v=\"1.0.0\"'\nprint(\"Sec-CH-UA-Full-Version:     ${header['Sec-CH-UA-Full-Version']}\");     // e.g.. '1.0.0'\nprint(\"Sec-CH-UA-Mobile:           ${header['Sec-CH-UA-Mobile']}\");           // e.g.. '?1' (true) or '?0' (false)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasabeef%2Fflutter_ua_client_hints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwasabeef%2Fflutter_ua_client_hints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasabeef%2Fflutter_ua_client_hints/lists"}