exportToJson method
Implementation
Future<void> exportToJson(
String tableName,
List<Map<String, dynamic>> records,
) async {
final jsonString = jsonEncode(records);
// Create a temporary file
final tempDir = await getTemporaryDirectory();
final file = File('${tempDir.path}/${tableName}_export.json');
await file.writeAsString(jsonString);
// Share the file
await Share.shareXFiles([XFile(file.path)], text: 'Export for $tableName');
}