sheetifye 1.1.0
sheetifye: ^1.1.0 copied to clipboard
Flutter spreadsheet engine with XLSX/CSV support, live editing, undo/redo, formula evaluation, clipboard, autofill, and a full persistence lifecycle.
Sheetifye #
The Native Flutter Spreadsheet Engine โ View, Edit, and Persist #
Sheetifye is a production-grade Flutter spreadsheet widget with native XLSX & CSV support, a live formula engine, full cell editing, undo/redo, clipboard, autofill, and a complete persistence lifecycle โ all rendered directly on the Flutter canvas with no WebView or PlatformView.
๐ฑ iOS |
๐ค Android |
๐ Web / Desktop |
๐ Docs ยท ๐ก Example ยท ๐ Changelog ยท ๐ Issues
โจ What's New in v1.1.0 #
Sheetifye has evolved from a viewer into a full spreadsheet editing platform:
- ๐๏ธ Cell Editing โ Inline editor overlay with formula support
- ๐พ Persistence Lifecycle โ
onSave,onSaveAs,onBeforeClose,onDiscardChangeshooks - โฉ๏ธ Undo / Redo โ Full command stack with dirty-state tracking
- ๐ Clipboard โ In-app range copy/paste with formula reference shifting + system TSV fallback
- โก Autofill โ Drag-to-fill with arithmetic and pattern detection
- ๐ข Live Formula Engine โ AST-based evaluator with real-time dependency recalculation
- ๐๏ธ Workbook Actions โ Extensible action menu (bottom sheet on mobile, popup on desktop)
- โ Validation โ Rule-based cell validation with visual feedback
- ๐งช 324 Tests โ Comprehensive coverage across engine, widget, and integration layers
Feature Highlights #
| Feature | Detail | |
|---|---|---|
| โก | Virtualized Rendering | 60+ FPS even with millions of cells โ direct Canvas painting, no per-cell widgets |
| ๐ฆ | XLSX & CSV Support | Native parsers for Excel and CSV files โ no WebView, no external services |
| ๐๏ธ | Cell Editing | Inline editor overlay; tap to edit, type = for formulas |
| ๐ข | Formula Engine | AST tokenizer + evaluator with live dependency graph recalculation |
| โฉ๏ธ | Undo / Redo | Command-pattern stack; integrates with dirty-state and save lifecycle |
| ๐ | Clipboard | Copy/paste ranges with formula shifting; reads system TSV from Excel/Sheets |
| โก | Autofill | Drag handle to extend values or arithmetic sequences |
| ๐พ | Persistence Hooks | Full save lifecycle โ dirty tracking, save, save as, discard, close interception |
| ๐๏ธ | Workbook Actions | Extensible menu with built-in and developer-injected actions |
| โ | Validation | Cell-level rules with blocked input and visual indicators |
| ๐ | Merged Cells | Pixel-perfect hit-testing and rendering for complex layouts |
| ๐จ | Full Theming | SheetifyeThemeData with dark mode auto-detection |
| ๐ | Cross-Platform | iOS, Android, Web, Windows, macOS, Linux |
Supported Platforms #
| Platform | Support | Rendering |
|---|---|---|
| iOS | โ | Native Canvas |
| Android | โ | Native Canvas |
| Web | โ | CanvasKit / HTML |
| Windows | โ | Native Canvas |
| macOS | โ | Native Canvas |
| Linux | โ | Native Canvas |
Installation #
flutter pub add sheetifye
Or add to pubspec.yaml manually:
dependencies:
sheetifye: ^1.1.0
Sheetifye uses Riverpod for state management. Wrap your app root in a
ProviderScopeonce โ if you already use Riverpod, no additional setup is needed.
Quick Start #
1. Initialize #
void main() {
runApp(const ProviderScope(child: MyApp()));
}
2. View a Spreadsheet (read-only) #
import 'package:sheetifye/sheetifye.dart';
Sheetifye.asset('assets/reports/sales_2024.xlsx')
3. Enable Editing + Save Lifecycle #
Sheetifye.asset(
'assets/reports/sales_2024.xlsx',
readOnly: false,
onSave: (workbook) async {
await myApi.save(WorkbookExporter.toJson(workbook));
return true; // mark clean
},
onSaveAs: (workbook) async {
final bytes = WorkbookExporter.toXlsxBytes(workbook);
await FilePicker.saveFile(bytes);
return true;
},
onBeforeClose: () async {
// Return true to allow close, false to cancel
return await showSaveDialog(context);
},
onWorkbookChanged: (workbook, isDirty) {
saveIndicator.value = isDirty;
},
)
Usage Examples #
๐ Load from Asset #
Sheetifye.asset('assets/template.xlsx')
๐ Load from Network #
Sheetifye.network(
'https://api.example.com/reports/latest.xlsx',
headers: {'Authorization': 'Bearer $token'},
)
๐พ Load from File #
Sheetifye.file(File('/storage/emulated/0/Download/report.xlsx'))
๐ง Load from Memory (e.g. file picker) #
final result = await FilePicker.platform.pickFiles(withData: true);
Sheetifye.memory(result!.files.first.bytes!)
๐ Load a CSV File #
Sheetifye.network('https://data.example.com/export.csv')
// CSV is auto-detected by file extension
Editing & Formula Entry #
When readOnly: false, users can:
- Double-tap (mobile) or press Enter / F2 (desktop) to open the inline cell editor
- Type
=to enter formula mode โ the formula bar shows the expression, the cell shows the result - Tab / Enter to confirm and advance to the next cell
- Escape to cancel
Sheetifye.asset(
'assets/data.xlsx',
readOnly: false, // โ enables the editing system
)
Undo & Redo #
Every edit is captured in a command stack. Users can undo/redo via:
- Keyboard shortcuts โ
Ctrl+Z/Ctrl+Y(desktop) - Workbook action menu โ Undo and Redo built-in actions
The onWorkbookChanged callback fires after each undo/redo, keeping your UI in sync.
Workbook Actions #
The workbook action menu provides extensible workbook-level operations. Built-in actions include Save, Save As, Export CSV, Export XLSX, Undo, Redo, and Discard Changes. Add your own:
import 'package:sheetifye/sheetifye.dart';
Sheetifye.asset(
'assets/data.xlsx',
customActions: [
WorkbookAction(
id: 'app.share',
label: 'Share with Team',
icon: Icons.share,
group: WorkbookActionGroup.sharing,
onExecute: (context, ref) async {
final workbook = ref.read(workbookProvider).workbook;
final csv = WorkbookExporter.toCsv(workbook);
await Share.share(csv);
},
),
],
)
The menu renders as a bottom sheet on mobile and a popup menu on desktop/web automatically.
Persistence & Export #
Dirty State #
onWorkbookChanged: (workbook, isDirty) {
// isDirty == true when there are unsaved changes
setState(() => _hasUnsavedChanges = isDirty);
},
Export Formats #
// JSON (for custom backends)
final json = WorkbookExporter.toJson(workbook);
// CSV (active sheet)
final csv = WorkbookExporter.toCsv(workbook);
// XLSX bytes (for file saving)
final bytes = WorkbookExporter.toXlsxBytes(workbook);
Custom Theming #
Sheetifye.asset(
'assets/data.xlsx',
theme: SheetifyeThemeData.light().copyWith(
primaryColor: Colors.deepPurple,
headerBackground: Colors.grey[50],
gridColor: Colors.blueGrey[100],
fontFamily: 'Inter',
),
)
Dark mode is detected automatically from Theme.of(context).brightness when no theme is provided.
Architecture #
Sheetifye follows a layered engine architecture with direct Canvas rendering at its core.
lib/src/
โโโ domain/ Pure entities โ Workbook, Sheet, Cell, CellRange
โโโ data/ Adapters โ XLSX parser (isolate), CSV parser, serializer
โโโ engine/ Runtime systems โ Formula, Clipboard, Autofill, Overlays, Structure
โโโ features/ Riverpod state + UI โ Workbook, Grid, Toolbar, Formula Bar, Actions
โโโ core/ Theme, utilities, grid layout math
โโโ public/ Consumer-facing API โ Sheetifye widget, WorkbookExporter, PersistenceOptions
Key design decisions:
- Canvas-first โ The grid draws directly to
Canvas, bypassing the Flutter widget tree per cell for maximum throughput. - Isolate parsing โ XLSX and CSV files are parsed in a
compute()isolate, keeping the UI thread free. - Command pattern โ Every mutation is encapsulated in a command, enabling undo/redo and dirty-state tracking.
- Dependency graph โ The formula engine tracks cell relationships for surgical re-evaluation on edit.
โ Full details in Architecture Guide
Comparison #
| Feature | Sheetifye | Syncfusion | PlutoGrid |
|---|---|---|---|
| XLSX Parsing | โ Native | ๐ก Add-on required | โ None |
| CSV Support | โ RFC-4180 | ๐ก Basic | โ None |
| Cell Editing | โ Full | โ Full | โ Full |
| Formula Engine | โ AST Native | ๐ก Partial | โ None |
| Undo / Redo | โ Command stack | ๐ก Limited | โ None |
| Clipboard | โ In-app + System | ๐ก Basic | โ None |
| Autofill | โ Smart fill | โ None | โ None |
| Virtualization | โ Full | โ Full | ๐ก Partial |
| Memory Usage | ๐ ~42 MB | ๐ด ~180 MB | ๐ก ~120 MB |
| License | MIT | ๐ฐ Commercial | MIT |
Testing #
Sheetifye ships with 324 passing tests across 31+ test files:
| Category | Files | Coverage |
|---|---|---|
| Engine โ Persistence | 12 | Dirty state, save lifecycle, crash resistance, recovery, export, async save |
| Engine โ Formula | 2 | Tokenizer, evaluator, dependency resolution |
| Engine โ Clipboard | 1 | In-app range copy/paste, TSV parsing, formula shifting |
| Engine โ Editing | 1 | Cell mutations, validation, undo/redo interaction |
| Engine โ Undo/Redo | 1 | Command stack, dirty state after undo |
| Engine โ Sorting/Filtering | 2 | Multi-column sort, filter state |
| Engine โ Autofill | 1 | Pattern detection, arithmetic sequences |
| Engine โ Virtualization | 1 | Viewport calculation, scroll accuracy |
| Engine โ Merged Cells | 1 | Layout, selection, hit-testing |
| Widget Tests | 5 | Formula bar, grid, toolbar, editor overlay, workbook |
| Integration Tests | 5+ | Mobile UX, desktop UX, web, stress, XLSX samples |
Run the full suite:
fvm flutter test
Roadmap #
- โ v1.0.0 โ Native XLSX viewer, virtualized grid, formula bar, merged cells, theming
- โ v1.1.0 โ Full editing system, persistence lifecycle, undo/redo, clipboard, autofill, formula engine, workbook actions, validation, mobile UX
- โ v1.2.0 โ Conditional formatting, charts, cell comments, multi-sheet editing
- โ v2.0.0 โ Collaborative editing hooks, advanced styling, named ranges, pivot-table rendering
Contributing #
We welcome contributions! Please read the Contributing Guide before opening a PR. Key requirements:
fvm flutter testmust pass (324+ tests)fvm flutter analyzemust report zero issues- New features must include tests and updated docs
License #
Sheetifye is released under the MIT License. See LICENSE for details.
Built with โค๏ธ by Vikas Poute
โญ If Sheetifye saves you time, please give it a star on GitHub. โญ