2021-09-12 01:23:12 +00:00
|
|
|
# User Agent Analyzer
|
|
|
|
|
2021-09-16 03:23:05 +00:00
|
|
|
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/user_agent_analyzer?include_prereleases)
|
2021-09-12 01:23:12 +00:00
|
|
|
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
|
2021-09-12 03:21:17 +00:00
|
|
|
[![License](https://img.shields.io/github/license/dart-backend/belatuk-common-utilities)](https://github.com/dart-backend/belatuk-common-utilities/blob/main/packages/user_agent/LICENSE)
|
2021-09-12 01:23:12 +00:00
|
|
|
|
|
|
|
**Replacement of `package:user_agent` with breaking changes to support NNBD.**
|
|
|
|
|
|
|
|
A library to identify the type of devices and web browsers based on `User-Agent` string.
|
|
|
|
|
|
|
|
Runs anywhere.
|
|
|
|
|
|
|
|
```dart
|
|
|
|
void main() async {
|
|
|
|
app.get('/', (req, res) async {
|
|
|
|
var ua = UserAgent(req.headers.value('user-agent'));
|
|
|
|
|
|
|
|
if (ua.isChrome) {
|
|
|
|
res.redirect('/upgrade-your-browser');
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
```
|