static List<String?> _lubanCompressList(List<CompressObject> objects) { var results = []; objects.forEach((_o) { results.add(_lubanCompress(_o)); }); return results as List<String?>; } **The above method was causing that error: Had to change to the below and resolved the error** static List<String?> _lubanCompressList(List<CompressObject> objects) { var results = []; objects.forEach((_o) { results.add(_lubanCompress(_o)); }); return (results as List<dynamic?>).cast<String?>(); }