front_matter 1.1.0
front_matter: ^1.1.0

Dart native
Flutter Android iOS

A front matter parser that extracts YAML metadata from the start of a file or string.

example/front_matter.dart

import 'dart:io';
import 'package:front_matter/front_matter.dart' as fm;

// Example 1 - Parse a string.
void example1() async {
  var file = File('example/hello-world.md');
  var fileContents = await file.readAsString();

  var doc = fm.parse(fileContents);

  print("The author is ${doc.data['author']}");
  print("The publish date is ${doc.data['date']}");
  print("The content is ${doc.content}");
}

// Example 2 - Read a file and parse its contents.
void example2() async {
  var doc = await fm.parseFile('example/hello-world.md');

  print("The author is ${doc.data['author']}");
  print("The publish date is ${doc.data['date']}");
  print("The content is ${doc.content}");
}

void main() async {
  await example1();
  await example2();
}
2
likes
100
pub points
66%
popularity

A front matter parser that extracts YAML metadata from the start of a file or string.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

Uploader

izolate@gmail.com

License

MIT (LICENSE)

Dependencies

yaml

More

Packages that depend on front_matter