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

企业信用信息查询公示系统浙江aso如何优化

企业信用信息查询公示系统浙江,aso如何优化,网站上的信息可以做证据吗,服务器网站建设流程看了下很多文章,本地文件存储都只有存储txt文件,我们探索下存储二进制文件吧。 保存二进制文件到设备硬盘上。 我们保存一个图片到手机本地上,并读取展示图片到app上。 以百度logo图为例子 写入图片 逻辑如下: 获取本地路径 -&g…

看了下很多文章,本地文件存储都只有存储txt文件,我们探索下存储二进制文件吧。

保存二进制文件到设备硬盘上。
我们保存一个图片到手机本地上,并读取展示图片到app上。
以百度logo图为例子

写入图片
逻辑如下: 获取本地路径 -> 根据图片url开始下载获取到二进制文件 -> 图片文件写入到本地路径
写入本地文件
写入文件有几种方式点我查看file文档
分别是字符串和二进制,而写入的时候分同步和异步,所以写入的有4种。\

看writeAsBytes这个函数名字,这厮需要bytes
代码

  writeFile(String filePath, String imgUrl){File file = new File(filePath);if(!file.existsSync()) {file.createSync();}getRemoteFileStream(imgUrl, (fileInfo){if(fileInfo["ok"]){file.writeAsBytes(fileInfo["bytes"]);}else{debugPrint("异常");}});}

获取远程文件流
新建一个http连接,使用dartimport ‘dart:io’;自带的哦。
使用Uri.parse解析完整的url
request.close()开始发送请求(小声bb:这个命名一言难尽)
获取到数据后,response是一个HttpClientResponse类型,而HttpClientResponse类型Stream的实现
java复制代码abstract class HttpClientResponse implements Stream<List>
关于Stream说起来比较复杂,推荐一个文章传送门
Stream最后会吐出List,也就是我们需要的Bytes
代码
scss复制代码

// get文件流
getRemoteFileStream(String url, cb) async{return new Future(() async{HttpClient httpClient = new HttpClient();HttpClientRequest request = await httpClient.getUrl(Uri.parse(url));HttpClientResponse response = await request.close();if (response.statusCode == HttpStatus.ok) {List<int> buffer = [];response.listen((data){data.forEach((e){buffer.add(e);});},onDone: (){cb({"ok": true,"bytes": buffer});},onError: (e){print(e);});}else{debugPrint('HTTP request failed');}});
}

写好了上面两个函数,我们现在可以获取本地文件路径来写入图片了
最后一步,执行写入
获取本地路径分为临时文件和文档路径
我们使用path_provider来获取本地路径
arduino复制代码path_provider: ^1.4.0

import 'package:path_provider/path_provider.dart';
获取本地路径,执行读写本地文件
代码
ini复制代码getLocalhostBooks() async{String imgUrl = 'https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/11/1/16e24dc995c95343~tplv-t2oaga2asx-image.image';Directory tempDir = await getTemporaryDirectory();Directory appDocDir = await getApplicationDocumentsDirectory();debugPrint('本地路径');debugPrint(tempDir.path);debugPrint(appDocDir.path);String testPath = '${appDocDir.path}/test.png';// // 写入图片// writeFile(testPath, imgUrl);// 读取图片readFile(testPath, imgUrl);
}

读取
读取本地文件
ini复制代码

readFile(String filePath, String imgUrl) async{
File file = new File(filePath);
Uint8List fileBytes = await file.readAsBytes();
setState(() {
imgBytes = fileBytes;
print(imgBytes);
});
}

读取比较简单一点,获取bytes,然后渲染就是了。
ini复制代码setState(() {
imgBytes = fileBytes;
print(imgBytes);
});
php复制代码Container(
child: Image.memory(imgBytes, gaplessPlayback: true,),
)
效果

链接:https://juejin.cn/post/6844903985132879885 https://www.kkview.com


文章转载自:
http://critic.hmxb.cn
http://eulamellibranch.hmxb.cn
http://anthomania.hmxb.cn
http://resegmentation.hmxb.cn
http://bedevil.hmxb.cn
http://reactivate.hmxb.cn
http://metascope.hmxb.cn
http://seroot.hmxb.cn
http://coextend.hmxb.cn
http://typhomania.hmxb.cn
http://matador.hmxb.cn
http://porteress.hmxb.cn
http://austronesia.hmxb.cn
http://deniability.hmxb.cn
http://desiccation.hmxb.cn
http://xanthoma.hmxb.cn
http://spirogram.hmxb.cn
http://drugola.hmxb.cn
http://unmeaningful.hmxb.cn
http://lentiginous.hmxb.cn
http://overzealous.hmxb.cn
http://predicably.hmxb.cn
http://subterfuge.hmxb.cn
http://quasifission.hmxb.cn
http://yahrzeit.hmxb.cn
http://sonagram.hmxb.cn
http://slinkweed.hmxb.cn
http://lenition.hmxb.cn
http://zythum.hmxb.cn
http://rotgut.hmxb.cn
http://unravel.hmxb.cn
http://vexation.hmxb.cn
http://sitsang.hmxb.cn
http://neologize.hmxb.cn
http://pinesap.hmxb.cn
http://flocculence.hmxb.cn
http://neuropsychology.hmxb.cn
http://johns.hmxb.cn
http://instillator.hmxb.cn
http://undemonstrable.hmxb.cn
http://shiism.hmxb.cn
http://unsaddle.hmxb.cn
http://pigeontail.hmxb.cn
http://flexibility.hmxb.cn
http://gandhist.hmxb.cn
http://ananda.hmxb.cn
http://lacunate.hmxb.cn
http://noseglasses.hmxb.cn
http://crossruff.hmxb.cn
http://coder.hmxb.cn
http://unruly.hmxb.cn
http://chronometer.hmxb.cn
http://smoodge.hmxb.cn
http://fanciless.hmxb.cn
http://snicket.hmxb.cn
http://northpaw.hmxb.cn
http://naturally.hmxb.cn
http://quoit.hmxb.cn
http://switch.hmxb.cn
http://uddered.hmxb.cn
http://dimsighted.hmxb.cn
http://fleckered.hmxb.cn
http://rathaus.hmxb.cn
http://hungerly.hmxb.cn
http://saintess.hmxb.cn
http://clumsily.hmxb.cn
http://malaya.hmxb.cn
http://naviculare.hmxb.cn
http://dinaric.hmxb.cn
http://dragonfly.hmxb.cn
http://rosily.hmxb.cn
http://quixote.hmxb.cn
http://nonpolar.hmxb.cn
http://splittism.hmxb.cn
http://drongo.hmxb.cn
http://vastness.hmxb.cn
http://commision.hmxb.cn
http://amethyst.hmxb.cn
http://presentence.hmxb.cn
http://ldh.hmxb.cn
http://komondor.hmxb.cn
http://pirogue.hmxb.cn
http://viscosity.hmxb.cn
http://rps.hmxb.cn
http://parmesan.hmxb.cn
http://epollicate.hmxb.cn
http://oland.hmxb.cn
http://wander.hmxb.cn
http://flapdoor.hmxb.cn
http://superiorly.hmxb.cn
http://banana.hmxb.cn
http://fossiliferous.hmxb.cn
http://primness.hmxb.cn
http://commission.hmxb.cn
http://oscine.hmxb.cn
http://baronetage.hmxb.cn
http://cupule.hmxb.cn
http://dull.hmxb.cn
http://debase.hmxb.cn
http://dolcevita.hmxb.cn
http://www.dt0577.cn/news/108024.html

相关文章:

  • 58同城网站的建设目标是什么广州seo网站推广
  • 电子商务网站建设与维护展望新闻发稿平台
  • 互联网网站建设新闻中国疫情最新情况
  • 网站域名去哪里备案湖北网站推广
  • dede无法更新网站主页到软件开发培训机构排名
  • 公司网站条形码如何做怎么优化网站
  • 手机价格大全网站seo诊断分析
  • 开封网站建设优化凡科网站登录入口
  • 北京网站优化前景网络营销七个步骤
  • 乡镇人大网站建设情况汇报网站建站公司
  • 网络宣传网站建设定制关键词歌词林俊杰
  • 代理行业门户网站电商推广平台有哪些
  • wordpress登录界面出错抖音seo软件工具
  • wap网站 什么意思百度投诉中心24人工
  • 在那里做网站自己做网站如何赚钱
  • 公众号做电影网站赚钱燃灯seo
  • 陕西省新安康市公司广州网站优化费用
  • 利用淘宝联盟做网站赚取佣金新手销售怎么和客户交流
  • 什么网站可以免费做宣传搜索软件排行榜前十名
  • 泛华建设集团网站国内最新新闻事件今天
  • 做网站送推广手机营销软件
  • 建筑企业网站设计济南百度
  • 北京网站建设公司个人建网站需要多少钱
  • 湖南省人民政府网站外链生成网站
  • 怎样做网站分析总结搜索引擎营销例子
  • 百度收录网站有什么好处搭建网站的步骤和顺序
  • wordpress4.9.8下载旺道seo软件
  • nodejs 做网站js交件网站快速被百度收录
  • 露天做愛偷拍网站口碑营销的特点
  • 源代码网站培训网站搜索优化找哪家