treasury_direct 3.0.2 icon indicating copy to clipboard operation
treasury_direct: ^3.0.2 copied to clipboard

A Dart library package to access the debt of the United States from the US Treasury Direct site.

treasury_direct #

Build Status codecov pub package

A Dart library package to access the debt of the United States from the US Treasury site. This package 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: 7156
Total row received: 7156
Oct 7, 2021: $28.43T
Oct 6, 2021: $28.43T
Oct 5, 2021: $28.43T
Oct 4, 2021: $28.43T
Oct 1, 2021: $28.43T
Sep 30, 2021: $28.43T
Sep 29, 2021: $28.43T
Sep 28, 2021: $28.43T
Sep 27, 2021: $28.43T
Sep 24, 2021: $28.43T
Sep 23, 2021: $28.43T
Sep 22, 2021: $28.43T
Sep 21, 2021: $28.43T
Sep 20, 2021: $28.43T
Sep 17, 2021: $28.43T
...

Debt to the Penny API Docs: #

https://fiscaldata.treasury.gov/datasets/debt-to-the-penny/

1
likes
140
pub points
0%
popularity

Publisher

verified publisher iconlarryaasen.com

A Dart library package to access the debt of the United States from the US Treasury Direct site.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

async, convert, http, intl

More

Packages that depend on treasury_direct