platform/packages/user_agent/user_agent/README.md
2021-06-21 13:43:02 +08:00

955 B

User Agent Analyzer

version Null Safety Gitter

License

Forked from user_agent to support NNBD

A library to identify the type of devices and web browsers based on User-Agent string.

Runs anywhere.

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 {
            // ...
        }
    });
}