Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
737 views
in Technique[技术] by (71.8m points)

flutter - type '(dynamic) => Null' is not a subtype of type '(String, dynamic) => void' of 'f' (tried to get api imgs in a list)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...