zeba_books_bib_dart

Overview

zeba_books_bib_dart is a pure Dart package for parsing and formatting bibliographic data in .bib, .ris, and .json formats. It supports international citation styles, DOI resolution via CrossRef/DataCite APIs, and JSON serialization for database storage.


Features

  • BibTeX Parsing: Convert raw BibTeX files into structured BibEntry objects.
  • Citation Styles: APA (7th Ed), MLA (9th Ed), Chicago.
  • DOI Resolver: Fetch metadata from CrossRef using a DOI.
  • JSON Export/Import: Works with SQLite/Hive for local storage.

Installation

Add the package to your pubspec.yaml:

dependencies:
  zeba_books_bib_dart:
    git:
      url: https://github.com/yourusername/zeba_books_bib_dart.git

Then run:

flutter pub get

Usage

Parse BibTeX

import 'package:zeba_books_bib_dart/zeba_books_bib_dart.dart';

final parser = BibParser();
final entries = parser.parse('''
@article{smith2020,
  author = {John Smith},
  title = {Flutter Dart Guide},
  journal = {Programming Journal},
  year = {2020}
}
''');

print(entries.first.fields['author']); // John Smith

Format Citation

final entry = entries.first;
final formatter = CiteFormatter(entry);
print(formatter.toStyle(Style.APA));

Fetch Metadata via DOI

final doiClient = DoiClient();
final bibEntry = await doiClient.fetch('10.1000/xyz123');
print(bibEntry?.fields['title']);

Key Classes

Class Description
BibEntry Represents a single bibliographic reference.
BibParser Parses raw .bib strings into List<BibEntry>.
CiteFormatter Formats BibEntry in APA, MLA, or Chicago style.
DoiClient Fetches metadata from DOI APIs.

Testing

Run tests with:

flutter test

License

This package is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.


Homepage

https://code.zeba.academy