bwu_pub_client 0.1.0+1

  • Installing
  • Versions
  • 9

BWU PubClient

Easy access to remote API from Dart.


It's not the simplest example but one I needed. For a given package it prints which dependency has a dependency constraint (direct or transitive) that prevents updating to the latest version

library bwu_pub_client.example.check_dependencies;

import 'dart:async' show Future, Stream;
import 'dart:collection';
import 'package:bwu_pub_client/bwu_pub_client.dart';
import 'package:http/http.dart' as http;

const startPackageName = 'appengine';

/// Collect all dependencies (direct and transitive).
Map<String, PubPackage> allDependencies = <String, PubPackage>{};

main() async {
  final pubClient = new PubClient(new http.Client());
  Map<String, Set<String>> outdated =
      await findLimitingDependencies(pubClient, startPackageName);
  outdated.forEach((k, v) {
        '"${k}" (latest: ${allDependencies[k].latest.version
            }) doesn\'t support the latest version of:');
    v.forEach((e) {
          '    "${e}" (${allDependencies[e].latest.version}) - constraint: ${

/// Collect all direct and transitive dependencies and let
/// `outdatedDependencies()` find which have constraints that limit updating to
/// the most recent version.
Future<Map<String, Set<String>>> findLimitingDependencies(
    PubClient pubClient, String packageName) async {
  /// Queue of packages to fetch info from
  final queue = new Queue<String>();

  while (queue.isNotEmpty) {
    /// Fetch data from
    final PubPackage package = await pubClient.fetchPackage(queue.removeLast());
    allDependencies[] = package;

    /// Queue transtitive dependencies to process
    final dependencies = package.latest.pubspec.dependencies;
    if (dependencies != null) {
      for (final p in dependencies.keys) {
        if (!allDependencies.containsKey(p) && !queue.contains(p)) {
  return outdatedDependencies();

/// Find the dependencies where a dependency constraint prevents updating to
/// the most recent version.
Map<String, Set<String>> outdatedDependencies() {
  final result = <String, Set<String>>{};
  final depending = findDependingPackages();
  depending.forEach((k, v) {
    v.forEach((d) {
      final dep = allDependencies[d].latest.pubspec.dependencies[k];
      /// Check if latest version is supported (only hosted packages are
      /// supported currently because others would require to fetch version
      /// information from a path or Git reference.
      if (dep.kind == DependencyKind.hosted &&
          !dep.versionConstraint.allows(allDependencies[k].latest.version)) {
        if (result[d] == null) {
          result[d] = new Set<String>()..add(k);
        } else {
  return result;

/// Builds a map from each dependency to the packages which depend on this 
/// dependency (from the set of transitive dependencies of the 
/// `startPackageName`).
Map<String, List<String>> findDependingPackages() {
  final result = {};
  allDependencies.forEach((k, v) {
    final dependencies = findDependingOn(k);
    result[k] = dependencies;
  return result;

/// Get the packages which depend on package [name].
List<String> findDependingOn(String name) {
  return allDependencies.keys
      .where((k) =>

prints for example

"gcloud" (latest: 0.2.0+1) doesn't support the latest version of:
    "googleapis_beta" (0.14.0) - constraint: >=0.10.0 <0.13.0
    "googleapis" (0.10.0) - constraint: >=0.2.0 <0.9.0
"appengine" (latest: 0.3.0) doesn't support the latest version of:
    "logging" (0.11.1) - constraint: >=0.9.3 <0.10.0

which shows that the package appengine has a constraint on logging which prevents to update to the latest logging version and that appengine also has a dependency on gcloud which isself has too narrow constraints for googleapis_beta and googleapis to update to the newest versions of these dependencies.



  • enable travis integration
  • use bwu_utils_dev default Grinder tasks


  • initial version

Use this package as a library

1. Depend on it

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

  bwu_pub_client: "^0.1.0+1"

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:bwu_pub_client/bwu_pub_client.dart';
Version Uploaded Documentation Archive
0.1.0+1 Jun 4, 2015 Go to the documentation of bwu_pub_client 0.1.0+1 Download bwu_pub_client 0.1.0+1 archive
0.1.0 Jun 1, 2015 Go to the documentation of bwu_pub_client 0.1.0 Download bwu_pub_client 0.1.0 archive


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

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
30 / 100
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

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


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 4 errors 10 hints.

    Strong-mode analysis of lib/src/pub_client.dart failed with the following error:

    line: 186 col: 25
    The argument type 'List' can't be assigned to the parameter type 'Iterable<String>'.

    Strong-mode analysis of lib/src/limiting_dependencies.dart gave the following hint:

    line: 3 col: 34
    The name Stream is shown, but not used.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use bwu_pub_client.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0
http ^0.11.2 0.11.3+16
logging ^0.11.1 0.11.3+1
pub_semver ^1.2.1 1.4.1
quiver ^0.21.4 0.21.4 0.29.0+1
Transitive dependencies
async 2.0.7
charcode 1.1.1
collection 1.14.9
http_parser 3.1.2
matcher 0.12.2+1
path 1.5.1
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
bwu_utils_dev ^0.1.0-dev.6
quiver_log ^1.0.3
stack_trace ^1.3.2 1.9.2
test ^0.12.2