i am trying to get api images in a list as bellow ---
var res = json.decode(response.body);
if (response.statusCode == 200) {
var items = json.decode(response.body).forEach((element) {
setState(() {
_img.add(NetworkImage(element["resplist"]["categoryBanner"]));
});
});
} else {
}
but having this error --
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: type '(dynamic) => Null' is not a subtype of type '(String, dynamic) => void' of 'f'
Please help!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…