Map<String, dynamic> decodeJson(dynamic data) { if (data is String) { return json.decode(data); } if (data.isEmpty) { return <String, dynamic>{}; } return data; }