![](/style/images/good.png)
![](/style/images/bad.png)
Flutter开发个人经验收集整理
source link: https://www.pkslow.com/archives/flutter-development
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
无聊学一下Flutter
开发,过程中还是遇到许多问题的,在这里权当整理一下,方便以后查收吧。
网络请求库dio
经过比较,选择这个不错的请求库dio
- GitHub。
使用示例如下:
import 'package:dio/dio.dart';
import 'package:pkslow_formula/domain/blog.dart';
void main() {
var dio = Dio();
dio
.get('https://inshortsapi.vercel.app/news?category=world')
.asStream()
.map((event) => event.data)
.map((event) => event['data'])
.map((event) => event[0])
.map((event) => Blog.fromMap(event))
.forEach((element) {
print(element.toString());
});
}
class Blog {
String author;
String content;
String imageUrl;
String readMoreUrl;
String url;
String title;
Blog(this.author, this.content, this.imageUrl, this.readMoreUrl, this.url,
this.title);
@override
String toString() {
return 'Blog{author: $author, content: $content, imageUrl: $imageUrl, readMoreUrl: $readMoreUrl, url: $url, title: $title}';
}
factory Blog.fromMap(Map<String, dynamic> map) {
return Blog(map['author'], map['content'], map['imageUrl'], map['readMoreUrl'], map['url'], map['title']);
}
}
Web模式下访问Network Image报错
当无法在Web模式下访问Image.network
时,通过添加启动参数--web-renderer html
:
References:Stackoverflow
启动ios模式器报错cocoapods not installed
用以下命令安装即可:
brew reinstall cocoapods
无法在IDEA上找到ios设备
执行以下命令:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
如果还不行就重启一下IDEA。
ListView
Flutter ListView and ScrollPhysics: A Detailed Look
Fetching Data in Flutter and Displaying in ListView
Latex
Web需要在index.html
添加依赖,参考:https://github.com/shah-xad/flutter_tex/tree/master/example/web
ios也要添加配置,同样参考上面的例子即可。
Code for all: GitHub
欢迎关注微信公众号<南瓜慢说>,将持续为你更新...
Recommendations:
Cloud Native
Terraform
Container: Docker/Kubernetes
Spring Boot / Spring Cloud
Https
如何制定切实可行的计划并好好执行
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK