toJson method

Map<String, dynamic>? toJson()

Implementation

Map<String, dynamic>? toJson() {
  final x = {
    "light": _stringify(light),
    "dark": _stringify(dark),
  };
  final y = x.entries.where((e) {
    if (e.value == null) return false;
    return true;
  });
  if (y.isEmpty) return null;
  return Map.fromEntries(y);
}