niddler_dart 0.5.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

Niddler network inspector for dart and flutter

latestVersion

Usage #

A simple usage example:

For a more complete example, see example/main.dart.

import 'package:niddler_dart/niddler_dart.dart';

main() {

final niddlerBuilder = NiddlerBuilder()
    ..bundleId = 'com.test.test'
    ..serverInfo = NiddlerServerInfo('Some descriptive name', 'Some description')
    ..port = 0; //0 to have niddler pick it's own port. Automatic discovery will make this visible

  final niddler = niddlerBuilder.build();
  await niddler.start();
  niddler.install();
  
  //Make http requests ...
  
  await niddler.stop();
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.5.0 #

  • Added support for flutter web by providing a no-op niddler implementation
  • Small bugfix that could cause the announcement manager to crash
  • Breaking change: NiddlerInjector.install(niddler); has been replaced with niddler.install();

0.4.0 #

  • Main release now tracks dart > 2.3.2
  • Added extra examples in main.dart

0.3.1-master #

  • Fix for dart pub

0.3.0-master #

  • Support dart 2.3.2 and up

0.2.1 #

  • Do not send 0 byte bodies

0.1.5 #

  • Revert dart compatibility change. Restrict running to dart < 2.3.2 for now

0.1.4 #

  • Support newer versions of dart by implementing noSuchMethod

0.1.3 #

  • Use isolates to greatly reduce main event locking

0.1.2 #

  • Added support for blacklisting urls

0.1.1 #

  • Removed dependency on http

0.1.0 #

  • Initial public version

example/main.dart

import 'dart:convert';

import 'package:http/http.dart' as http;
import 'package:niddler_dart/niddler_dart.dart';

Future<void> main() async {
  final niddlerBuilder = NiddlerBuilder()
    ..bundleId = 'com.test.test'
    ..serverInfo =
        NiddlerServerInfo('Some descriptive name', 'Some description')
    ..port =
        0; //0 to have niddler pick it's own port. Automatic discovery will make this visible

  final niddler = niddlerBuilder.build()..addBlacklist(RegExp('.*/get'));
  await niddler.start();
  niddler.install();

  final value = {
    'test': 'data',
    'arrayData': [
      '1',
      '2',
      '3',
      {'nested': 'nestedData'}
    ]
  };

  final response = await http.post('http://httpbin.org/post',
      body: json.encode(value), headers: {'content-type': 'application/json'});
  final response2 = await http.get('http://httpbin.org/get',
      headers: {'content-type': 'application/json'});
  await http.get(
      'https://raw.githubusercontent.com/zynksoftware/samples/master/XML%20Samples/Credit%20note%20with%20Sales%20Payment.xml');
  await http.get('https://www.google.com/'); //Some html!
  await http.get('http://placekitten.com/200/300');

  print('Post body: ${response.body}');
  print('Get body (blacklisted): ${response2.body}');

  await Future.delayed(Duration(seconds: 100));

  await niddler.stop();

  await Future.delayed(Duration(seconds: 2));
}

Use this package as a library

1. Depend on it

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


dependencies:
  niddler_dart: ^0.5.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:niddler_dart/niddler_dart.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
37
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]
69
Learn more about scoring.

We analyzed this package on Nov 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:niddler_dart/niddler_dart.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.2 <3.0.0
pointycastle ^1.0.1 1.0.2
synchronized ^2.1.0 2.1.0+1
uuid ^2.0.1 2.0.4
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
typed_data 1.1.6
Dev dependencies
http ^0.12.0+1
pedantic ^1.0.0
test ^1.0.0