fpad 1.0.0 copy "fpad: ^1.0.0" to clipboard
fpad: ^1.0.0 copied to clipboard

A lightweight offline-safe structured file format (.fpad) with encoding, decoding, schema validation, and file IO utilities.

example/fpad_example.dart

import 'dart:io';
import 'package:fpad/fpad.dart';

void main() async {
  print('--- FPAD Example ---');

  // Create sample data
  final groceries = FPadList(
    id: 'list_01',
    name: 'Groceries',
    items: [
      FPadItem(id: 'item_01', name: 'Milk', extra: {'quantity': 2}),
      FPadItem(id: 'item_02', name: 'Eggs', extra: {'quantity': 12}),
    ],
  );

  final tasks = FPadList(
    id: 'list_02',
    name: 'Tasks',
    items: [
      FPadItem(id: 'item_03', name: 'Clean room'),
      FPadItem(id: 'item_04', name: 'Pay bills'),
    ],
  );

  final schema = FPadSchema(
    version: '1.0.0',
    lists: [groceries, tasks],
    extra: {'app': 'FPAD Demo'},
  );

  // Save to file
  final outputPath = 'example_output.fpad';
  await FPadFileIO.saveToFile(outputPath, schema);
  print('Saved .fpad file to: $outputPath');

  // Read from file
  final loaded = await FPadFileIO.readFromFile(outputPath);
  print('Loaded .fpad data:');
  print('Version: ${loaded.version}');
  print('Lists:');

  for (final list in loaded.lists) {
    print('  - ${list.name}:');
    for (final item in list.items) {
      print('      * ${item.name}');
    }
  }

  // Clean up example output file
  final file = File(outputPath);
  if (await file.exists()) {
    print('\nDeleting demo file...');
    await file.delete();
  }

  print('\n--- Example Completed ---');
}
0
likes
0
points
28
downloads

Publisher

verified publisherhax.co.in

Weekly Downloads

A lightweight offline-safe structured file format (.fpad) with encoding, decoding, schema validation, and file IO utilities.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on fpad