treasury_direct 0.1.1

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

treasury_direct

Build Status codecov

A Dart library package to access the debt of the United States from the US Treasury Direct site. Can be used in a command line app or in a Flutter app.

Example

import 'package:treasury_direct/treasury_direct.dart';
import 'package:treasury_direct/src/debt_entry.dart';

void main() async {
  final td = TreasuryDirect();
  final list = await td.downloadDebtFeedAsync(pagesize: 15);

  print('Total possible rows: ${list.totalRows}');

  print('Total row received: ${list.mostRecentList.length}');
  for (DebtEntry entry in list.mostRecentList) {
    print('${DebtEntry.dateFormatted(entry.effectiveDate)}: ${DebtEntry.currencyShortened(entry.totalDebt, false)}');
  }
}

Expected output:

Total possible rows: 6486
Total row received: 15
Nov 8, 2018: $21.73T
Nov 7, 2018: $21.69T
Nov 6, 2018: $21.69T
Nov 5, 2018: $21.68T
Nov 2, 2018: $21.68T
Nov 1, 2018: $21.68T
Oct 31, 2018: $21.70T
Oct 30, 2018: $21.70T
Oct 29, 2018: $21.70T
Oct 26, 2018: $21.69T
Oct 25, 2018: $21.70T
Oct 24, 2018: $21.67T
Oct 23, 2018: $21.68T
Oct 22, 2018: $21.67T
Oct 19, 2018: $21.67T

Treasury Direct API Docs:

https://www.treasurydirect.gov/webapis/webapisdebt.htm

0.1.0

  • Initial Open Source release.

example/example.dart

import 'package:treasury_direct/treasury_direct.dart';
import 'package:treasury_direct/src/debt_entry.dart';

void main() async {
  final td = TreasuryDirect();
  final list = await td.downloadDebtFeedAsync(pagesize: 15);

  print('Total possible rows: ${list.totalRows}');

  print('Total row received: ${list.mostRecentList.length}');
  for (DebtEntry entry in list.mostRecentList) {
    print(
        '${DebtEntry.dateFormatted(entry.effectiveDate)}: ${DebtEntry.currencyShortened(entry.totalDebt, false)}');
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  treasury_direct: ^0.1.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:treasury_direct/treasury_direct.dart';
  
Version Uploaded Documentation Archive
0.1.1 Nov 11, 2018 Go to the documentation of treasury_direct 0.1.1 Download treasury_direct 0.1.1 archive
0.1.0 Nov 11, 2018 Go to the documentation of treasury_direct 0.1.0 Download treasury_direct 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
90
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 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:treasury_direct/treasury_direct.dart.

Health issues and suggestions

Document public APIs (-9.57 points)

22 out of 23 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-dev.68.0 <3.0.0
async ^2.0.8 2.0.8
convert ^2.0.2 2.0.2
http ^0.12.0 0.12.0
intl ^0.15.7 0.15.7
Transitive dependencies
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
coverage ^0.12.3
test ^1.5.1