importDrawingsJson method
Imports drawings from a JSON string, restoring them onto the chart.
Implementation
void importDrawingsJson(String jsonString) {
try {
final decoded = jsonDecode(jsonString);
if (decoded is List) {
recordDrawingSnapshot();
_drawings
..clear()
..addAll(decoded.map(
(item) => ChartDrawing.fromJson(item as Map<String, dynamic>),
));
notifyListeners();
}
} catch (e) {
debugPrint('Error importing drawings JSON: $e');
}
}