swapi_client 0.1.0

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

swapi_client

Build Status codecov

A library that makes it easy to fetch data from SWAPI - The Star Wars API.

This is a pure Dart library which relies on the http package. Therefore, it can be used cross-platform, from Flutter to Web to server-side.

Usage

You can fetch data from the Star Wars API without any api or auth tokens. Simply create an instance of the SwapiClient class and start fetching away!

import 'package:swapi_client/swapi_client.dart';

void main() async {
  final swapi = SwapiClient();

  // Fetches and prints the list of Star Wars Films
  print(await swapi.films());

  // Fetches and prints the first page of Star Wars characters. Pagination
  // information included as part of the response, so it's easy to create
  // paginated experiences!
  print(await swapi.people());
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

0.1.0

  • Initial version of the Star Wars API for Dart

example/swapi_client_example.dart

import 'package:swapi_client/swapi_client.dart';

void main() async {
  final swapi = SwapiClient();

  // Fetches and prints the list of Star Wars Films
  print(await swapi.films());

  // Fetches and prints the first page of Star Wars characters. Pagination
  // information included as part of the response, so it's easy to create
  // paginated experiences!
  print(await swapi.people());
}

Use this package as a library

1. Depend on it

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


dependencies:
  swapi_client: ^0.1.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:swapi_client/swapi_client.dart';
  
Version Uploaded Documentation Archive
0.1.0 Nov 11, 2018 Go to the documentation of swapi_client 0.1.0 Download swapi_client 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
9
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
51
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs (-9.47 points)

143 out of 151 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
http ^0.12.0 0.12.0
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
test ^1.0.0