采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
final response=await http.get(‘http://www.devio.org/io/flutter_app/json/test_common_model.json’); 填写路径的时候报红线,说 The argument type ‘String’ can’t be assigned to the parameter type ‘Uri’
亲说使用的http版本需要按照提示将url转成Uri进行传递:
import 'package:http/http.dart' as http; var url = Uri.parse('https://example.com/whatsit/create'); var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'}); print('Response status: ${response.statusCode}'); print('Response body: ${response.body}'); print(await http.read('https://example.com/foobar.txt'));
好的好的,非常感谢!
登录后可查看更多问答,登录/注册
解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。
1.4k 4
1.6k 1
3.7k 5
1.6k 3
1.4k 5