angel_user_agent 2.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 50

user_agent

Middleware to inject a User Agent object into requests. For convenience's sake, it also exports the user_agent library.

2.0.0

  • Angel 2 + Dart 2 updates

example/example.dart

import 'dart:io';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_user_agent/angel_user_agent.dart';
import 'package:user_agent/user_agent.dart';

main() async {
  var app = new Angel();
  var http = new AngelHttp(app);

  app.get(
    '/',
    waterfall([
      parseUserAgent,
      (req, res) {
        var ua = req.container.make<UserAgent>();
        return ua.isChrome
            ? 'Woohoo! You are running Chrome.'
            : 'Sorry, we only support Google Chrome.';
      },
    ]),
  );

  var server = await http.startServer(InternetAddress.anyIPv4, 3000);
  print('Listening at http://${server.address.address}:${server.port}');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  angel_user_agent: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:angel_user_agent/angel_user_agent.dart';
  
Version Uploaded Documentation Archive
2.0.0 Sep 11, 2018 Go to the documentation of angel_user_agent 2.0.0 Download angel_user_agent 2.0.0 archive
1.0.1 Jan 25, 2017 Go to the documentation of angel_user_agent 1.0.1 Download angel_user_agent 1.0.1 archive
1.0.0 Jan 14, 2017 Go to the documentation of angel_user_agent 1.0.0 Download angel_user_agent 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, other

Primary library: package:angel_user_agent/angel_user_agent.dart with components: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
angel_framework ^2.0.0-alpha 2.0.0-alpha.4
user_agent ^2.0.0 2.0.0
Transitive dependencies
angel_container 1.0.0-alpha.9
angel_http_exception 1.0.0+3
angel_model 1.0.0+1
angel_route 3.0.0
body_parser 1.1.1
charcode 1.1.2
code_buffer 1.0.1
collection 1.14.11
combinator 1.0.0+3
dart2_constant 1.0.2+dart2
file 5.0.6
http_parser 3.1.3
http_server 0.9.8
intl 0.15.7
logging 0.11.3+2
matcher 0.12.4
merge_map 1.0.1
meta 1.1.6
mime 0.9.6+2
path 1.6.2
quiver 2.0.0+1
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.4
tuple 1.0.2
typed_data 1.1.6