This is not the correct answer but just try this approach
json["data"] != null && json["data"] is Map<String, dynamic> ? Data.fromJson(json["data"]) : null