copyAllAsJson method

Future<String?> copyAllAsJson()

Implementation

Future<String?> copyAllAsJson() async {
  if (!canCopyJson) return null;
  copyingJson = true;
  notifyListeners();
  try {
    final rows = await _fetchAllActiveRows();
    final exportRows = rows
        .map((row) => Map<String, Object?>.from(row)..remove('_rowid_'))
        .toList();
    copyingJson = false;
    notifyListeners();
    return jsonEncode(exportRows);
  } catch (error) {
    copyingJson = false;
    lastError = 'Failed to copy JSON: $error';
    notifyListeners();
    return null;
  }
}