pub_client 3.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 66

Build Status Pub

pub_client #

A library for interacting with the REST API for Pub (pub.dartlang.org/api). This package currently uses Dartson to decode the JSON responses from Pub into concrete types.

Supported API Calls #

  • getPageOfPackages(pageNumber) - Retrieves a single page of packages from Pub with the most recently updated packages first.
  • getAllPackages() - Retrieves all possible pages of packages. NOTE: This method has the potential to generate a lot of network traffic.
  • getPackage(packageName) - Retrieves a single package by it's name.

Example Usage #

import "package:pub_client/pub_client.dart";

main() async {
    PubClient client = new PubClient();
    FullPackage package = await client.getPackage("test");
    print(package.latest.version);
}

v3.0.3 #

  • Fix TypeError in Dependencies.toJson
  • Update dependencies

example/main.dart

import 'package:pub_client/pub_client.dart';

main() async {
  var client = new PubClient();
  var package = await client.getPackage("test");
  print(package.latest.version);
}

Use this package as a library

1. Depend on it

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


dependencies:
  pub_client: ^3.0.3

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:pub_client/pub_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Nov 22, 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:pub_client/pub_client.dart.

Health issues and suggestions

Document public APIs. (-1 points)

149 out of 149 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/pub_client.dart. (-5.36 points)

Analysis of lib/pub_client.dart reported 11 hints, including:

line 16 col 22: Don't explicitly initialize variables to null.

line 16 col 35: Use = to separate a named parameter from its default value.

line 16 col 53: Use = to separate a named parameter from its default value.

line 21 col 20: Unnecessary new keyword.

line 25 col 12: Unnecessary new keyword.

Fix lib/src/models.dart. (-2.96 points)

Analysis of lib/src/models.dart reported 6 hints, including:

line 108 col 24: Unnecessary new keyword.

line 113 col 47: Unnecessary new keyword.

line 115 col 47: Unnecessary new keyword.

line 117 col 51: Unnecessary new keyword.

line 169 col 14: Unnecessary new keyword.

Fix lib/src/models.g.dart. (-1.99 points)

Analysis of lib/src/models.g.dart reported 4 hints:

line 139 col 14: The declaration '_$DependenciesFromJson' isn't referenced.

line 157 col 22: The declaration '_$DependenciesToJson' isn't referenced.

line 173 col 15: The declaration '_$GitDependencyFromJson' isn't referenced.

line 180 col 22: The declaration '_$GitDependencyToJson' isn't referenced.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (json_annotation).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http >=0.11.0 <0.13.0 0.12.0+2
json_annotation >=1.0.0 <3.0.0 2.4.0 3.0.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner >=0.10.1 <2.0.0
json_serializable >=1.0.1 <3.0.0
path ^1.6.2 1.6.4
test any