toJson method

Map<String, dynamic> toJson()

Serializes this viewport to JSON.

Returns a map suitable for JSON encoding containing x, y, and zoom values.

Example:

final viewport = GraphViewport(x: 100, y: 50, zoom: 1.5);
final json = viewport.toJson();
// Returns: {'x': 100.0, 'y': 50.0, 'zoom': 1.5}

Implementation

Map<String, dynamic> toJson() => {'x': x, 'y': y, 'zoom': zoom};