Map<String, Object?> toJson() { final data = <String, Object?>{}; if (key != null) data['key'] = key; return data; }