encode method

String encode()

Encodes this state as stable, human-readable JSON.

Implementation

String encode() {
  final sorted = [...endpoints]..sort((a, b) => a.key.compareTo(b.key));
  return "${const JsonEncoder.withIndent("  ").convert({
        "version": 1,
        "app_id": appId,
        "endpoints": sorted.map((endpoint) => endpoint.toJson()).toList(),
      })}\n";
}