本文主要是介绍Flutter-使用dio插件请求网络(get ,post,下载文件),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
引入库:dio: ^2.1.13可直接运行的代码:包含了post,get 下载文件 import 'package:flutter/material.dart'; import 'package:dio/dio.dart';void main() {runApp(new MaterialApp(title: 'Container demo',home: new visitNetPage(),)); }class visitNetPage extends StatefulWidget {@overrideState<StatefulWidget> createState() {// TODO: implement createStatereturn new visitNetState();} }class visitNetState extends State<visitNetPage> {@overrideWidget build(BuildContext context) {// TODO: implement buildreturn MaterialApp(home: Scaffold(appBar: AppBar(title: Text('json解析'),),body: Container(padding: EdgeInsets.all(10.0),child: Column(children: <Widget>[R
这篇关于Flutter-使用dio插件请求网络(get ,post,下载文件)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!