Skip to main content

tom_todo_model 6.0.0 copy "tom_todo_model: ^6.0.0" to clipboard
tom_todo_model: ^6.0.0 copied to clipboard

The Tom workspace's item model (TomItem: one record for todos, reminders, journal entries, mindmap nodes, emails and document sections, with item types and extensions) and the *.todo.yaml file codec, [...]

example/tom_todo_model_example.dart

// Parse a todo file, complete one item, give another a reminder, and write
// the file back as text in which only the edited keys changed.
import 'package:tom_todo_model/tom_todo_model.dart';

const _file = '''
quest: garden
todos:
  # the beds
  - id: gx1_ajka-plant
    title: Plant the beds
    status: not-started   # first
  - id: gx2_ajka-water
    title: Water the beds
    status: not-started
''';

void main() {
  final file = TomTodoFile.parse(_file);
  for (final item in file.items) {
    final types = item.types().map((t) => t.wire).join(', ');
    print('${item.id}: ${item.headline} (${item.status.wire}; $types)');
  }

  final entry = file.entryFor('gx1_ajka-plant')!;
  final done = entry.item!.copy()
    ..changeStatus(TomTodoStatus.completed, on: DateTime(2026, 10, 21));
  var text = file.withItem(entry.index, done);

  // Any item can ring: the new field is written because it is set.
  final reread = TomTodoFile.parse(text);
  final water = reread.entryFor('gx2_ajka-water')!;
  final ringing = water.item!.copyWith(
    reminders: [TomItemReminder(at: '2026-10-22T07:00+02:00')],
  );
  text = reread.withItem(water.index, ringing);
  print('---');
  print(text);
}
0
likes
150
points
1.57k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

The Tom workspace's item model (TomItem: one record for todos, reminders, journal entries, mindmap nodes, emails and document sections, with item types and extensions) and the *.todo.yaml file codec, which edits a todo file as splices into its own text.

Repository (GitHub)
View/report issues

Topics

#todo #yaml

License

BSD-3-Clause (license)

Dependencies

meta, yaml

More

Packages that depend on tom_todo_model