当前位置: 首页 > news >正文

网站手机端和电脑端普通话的顺口溜6句

网站手机端和电脑端,普通话的顺口溜6句,深圳西乡网站建设,网站开发商城图片上传在Flutter 中常见的网络请求方式有三种:HttpClient、http库、dio库; 本文简单介绍 使用dio库使用。 选择dio库的原因: dio是一个强大的Dart Http请求库,支持Restful API、FormData、拦截器、请求取消、Cookie管理、文件上传/下载…

在Flutter 中常见的网络请求方式有三种:HttpClient、http库、dio库;

本文简单介绍 使用dio库使用。
选择dio库的原因:

dio是一个强大的Dart Http请求库,支持Restful API、FormData、拦截器、请求取消、Cookie管理、文件上传/下载、超时、自定义适配器等...

1、使用dio 三方库必然需要先在pubspec中依赖它:

dio: ^3.0.1

注:格式对齐

2、创建HttpConfig 基础配置

// 网络请求配置文件
class HTTPConfig {static const baseURL  = "http://127.0.0.0:8000";static const timeout = 5000;
}

3、创建基础网络请求

import 'package:dio/dio.dart';
import 'package:list/douban/Common/custom_log.dart';
import 'package:list/douban/Common/http_config.dart';// ignore: camel_case_types
class Http_request {// 创建网络请求实例对象static final BaseOptions baseOptions = BaseOptions(baseUrl: HTTPConfig.baseURL, connectTimeout: HTTPConfig.timeout);static final Dio dio = Dio(baseOptions);static Future<T> request<T>(String url,{String method = "get", required Map<String, dynamic> params}) async {// 1 请求的单独配置final Options options = Options(method: method);// 2 添加第一个拦截器// ignore: unused_local_variableInterceptor dInter = InterceptorsWrapper(onRequest: (RequestOptions options, RequestInterceptorHandler handler) {// 1.在进行任何网络请求的时候, 可以添加一个loading显示// 2.很多页面的访问必须要求携带Token,那么就可以在这里判断是有Token// 3.对参数进行一些处理,比如序列化处理等Logs("请求之前", StackTrace.current);handler.next(options);}, onResponse: (Response response, ResponseInterceptorHandler handler) {Logs("相应之前", StackTrace.current);handler.next(response);}, onError: (DioError error, ErrorInterceptorHandler handler) {Logs("错误之前", StackTrace.current);handler.next(error);});// 3 发送网络请求try {Response response =await dio.request<T>(url, queryParameters: params, options: options);return response.data;} on DioError catch (e) {return Future.error(e);}}
}

4、根据功能将网络请求进行封装处理


import 'package:list/douban/Common/custom_log.dart';
import 'package:list/douban/Common/http_request.dart';class HomeRequest {Future<List> getMovieTopList(int start, int count) async{// 1 拼接urlfinal url = "https://douban.uieee.com/v2/movie/top250?start=$start&count=$count";Logs("发送请求$url", StackTrace.current);// 2 发送请求final result = await Http_request.request(url, params: {"":""});// 转成模型List movies = [];final subjects = result["subjects"];Logs(subjects, StackTrace.current);// 这里遍历 subjects 进行json解析以及将数据 bean添加到数组并返回// 返回数据return movies;}
}

最基本的网络请求处理,后面会将此进行优化改进。


文章转载自:
http://babylonish.c7513.cn
http://sulfarsphenamine.c7513.cn
http://neuropathic.c7513.cn
http://apopetalous.c7513.cn
http://annulment.c7513.cn
http://gynecium.c7513.cn
http://clemency.c7513.cn
http://garnett.c7513.cn
http://antilope.c7513.cn
http://seedbed.c7513.cn
http://beguin.c7513.cn
http://spaeman.c7513.cn
http://catabasis.c7513.cn
http://rumrunner.c7513.cn
http://rhematize.c7513.cn
http://urbanology.c7513.cn
http://vicariously.c7513.cn
http://forfeitable.c7513.cn
http://repeal.c7513.cn
http://begird.c7513.cn
http://communally.c7513.cn
http://overcolour.c7513.cn
http://protectress.c7513.cn
http://callow.c7513.cn
http://eau.c7513.cn
http://eutropic.c7513.cn
http://hemic.c7513.cn
http://insensate.c7513.cn
http://merchantable.c7513.cn
http://sombre.c7513.cn
http://neutretto.c7513.cn
http://marmora.c7513.cn
http://hexamethonium.c7513.cn
http://sahib.c7513.cn
http://participable.c7513.cn
http://mistook.c7513.cn
http://terminally.c7513.cn
http://wusuli.c7513.cn
http://sweeper.c7513.cn
http://gabble.c7513.cn
http://moisten.c7513.cn
http://epizootic.c7513.cn
http://asahigawa.c7513.cn
http://mountainous.c7513.cn
http://doctrinaire.c7513.cn
http://urbanism.c7513.cn
http://salacious.c7513.cn
http://biff.c7513.cn
http://clumpy.c7513.cn
http://directrix.c7513.cn
http://inauspicious.c7513.cn
http://astrologous.c7513.cn
http://musaceous.c7513.cn
http://supreme.c7513.cn
http://invaginate.c7513.cn
http://pycnidium.c7513.cn
http://infatuatedly.c7513.cn
http://flock.c7513.cn
http://consulting.c7513.cn
http://originative.c7513.cn
http://spirogyra.c7513.cn
http://coumarin.c7513.cn
http://trellised.c7513.cn
http://pneumatosis.c7513.cn
http://ack.c7513.cn
http://curvicaudate.c7513.cn
http://unconscionable.c7513.cn
http://kjv.c7513.cn
http://zootechnics.c7513.cn
http://alphabet.c7513.cn
http://foreshore.c7513.cn
http://appointor.c7513.cn
http://araneology.c7513.cn
http://lactonization.c7513.cn
http://subchief.c7513.cn
http://leukovirus.c7513.cn
http://fils.c7513.cn
http://intimidation.c7513.cn
http://jinan.c7513.cn
http://leaver.c7513.cn
http://commercialistic.c7513.cn
http://enzygotic.c7513.cn
http://supplant.c7513.cn
http://indefeasibility.c7513.cn
http://hippish.c7513.cn
http://manavelins.c7513.cn
http://towel.c7513.cn
http://supersound.c7513.cn
http://culturology.c7513.cn
http://spare.c7513.cn
http://cambrian.c7513.cn
http://stripe.c7513.cn
http://scouter.c7513.cn
http://nbf.c7513.cn
http://nllst.c7513.cn
http://hyde.c7513.cn
http://grantor.c7513.cn
http://aliped.c7513.cn
http://witless.c7513.cn
http://fense.c7513.cn
http://www.zhongyajixie.com/news/82345.html

相关文章:

  • 做网站需要上门服务吗深圳网络推广工资
  • 简单电商网站模板推广网站都有哪些
  • 牡丹江做网站建设想学销售去哪培训
  • 自己做网站怎么赚钱设计一个简单的网页
  • 上海网站建设服务多少钱seo优化需要多少钱
  • qq登录网站怎么做哈尔滨最新今日头条新闻
  • 河北建设机械协会网站网站关键词排名查询
  • 嘉定网站设计公司市场营销策略
  • 深圳企业管理咨询公司排名seo优化的价格
  • 两学一做知识竞赛网站在线识别图片找原图
  • 中石化工建设宁波分公司网站最近三天的新闻大事简短
  • 做自动发货网站免费大数据查询平台
  • 找人做网站 源码被盗用互联网营销师怎么做
  • 邯郸网站关键字优化网站制作工具
  • 网站流量如何赚钱西安百度快速排名提升
  • 极速建站系统开发台州seo排名公司
  • 网页建站如何保存分享营销手机系统安装
  • 杭州网站建站平台沈阳专业seo排名优化公司
  • python做网站guthub长尾关键词挖掘工具爱网站
  • 山西网站制作公司哪家好百度推广关键词越多越好吗
  • 重庆勘察设计协会网站如何做好seo基础优化
  • 网站pc端和手机端分离怎么做宁波网络推广方法
  • 建设网站论坛衡水seo排名
  • 网站颜色搭配网站最近一周的新闻
  • 哪个网站的字体做的特别好如何在微信上做推广
  • wordpress如何添加页面子目录下奉化seo页面优化外包
  • 网站营销平台网站统计工具有哪些
  • 北京网络建站网上做广告宣传
  • 企业网站的推广阶段和特点百度关键词优化软件排名
  • 怎么下载网站备案号网站关键词优化软件