user_agent_parser 0.0.1+2 copy "user_agent_parser: ^0.0.1+2" to clipboard
user_agent_parser: ^0.0.1+2 copied to clipboard

A Dart-based User-Agent string parser. This package aims to identify the type of web browser entirely from a User-Agent string.

example/example.dart

import 'package:user_agent_parser/user_agent_parser.dart';

void main() {
  UserAgentParser parser = UserAgentParser();

  String userAgent1 =
      'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1';
  Result result = parser.parseResult(userAgent1);

  print(result.browser.name); // Chrome
  print(result.browser.unformattedName); // CriOS
  print(result.browser.version); // 87.0.4280.77
  print(result.browser
      .parsedWithRegex); // r'(?<unformattedName>crmo|crios)\/(?<version>[\w\.]+)'
}
1
likes
40
pub points
34%
popularity

Publisher

verified publisherkenmortonjr.com

A Dart-based User-Agent string parser. This package aims to identify the type of web browser entirely from a User-Agent string.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on user_agent_parser