Flutter get base User-Agent
In the pubspec.yaml
of your flutter project, add the following dependency:
dependencies:
...
base_ua: <latest_version>
git:
url: https://github.com/binhitmobile/base_ua.git
ref: master
In your library add the following import:
import 'package:base_ua/base_ua.dart';
Using
Future<void> getUserAgent() async {
String platformVersion;
try {
String userAgent = await _baseUaPlugin.getBaseUserAgent() ?? "";
debugPrint("UA: $userAgent");
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
}