当前位置:网站首页>Flutter经验整理
Flutter经验整理
2022-08-11 11:25:00 【雨沐Andy】
flutter经验总结,稍候会整理进简历
1:使用flutter_screenutil做跨平台适配时,ios页面个别细节需要微调整
2: 再IOS平台上底部弹窗需要使用SafeArea包裹,避免出现弹窗底部按钮和导航栏遮挡
3:优先考虑使用update['id']这种方式局部刷新页面
4:主题的更换,使用一个类来实现,主要涉及颜色、图片等资源,避免到处传参
5:发挥flutter跨平台的最大特性,个别特殊功能使用PlatformView或者Channel和原生交互实现
6:
flutter异常捕获(最终还是通过原生上报)
1:原生接入友盟统计 2:在flutter和原生进行channle交互配置 3:在flutter中通过FlutterError.onError,提供⼀个⾃定义的错误处理回调 4:最终还是通过原生上报
MobclickAgent.reportError
//全局异常的捕捉
class AppCatchError {
run(Widget app) {
///Flutter 框架异常
FlutterError.onError = (FlutterErrorDetails details) async {
///线上环境
if (BaseUrl.DEBUG == false) {
Zone.current.handleUncaughtError(details.exception, details.stack!);
} else {
//开发期间 print
FlutterError.dumpErrorToConsole(details);
}
};
runZonedGuarded(() {
//受保护的代码块
runApp(app);
}, (error, stack) => catchError(error, stack));
}
///对搜集的 异常进行处理 上报等等
catchError(Object error, StackTrace stack) {
// print("AppCatchError>>>>>>>>>>: $kReleaseMode"); //是否是 Release版本
// print('AppCatchError message:$error,stack$stack');
if (BaseUrl.DEBUG == true) {
// if (kDebugMode) {
// ignore: avoid_print
print(
'\n\n\n\n全局异常捕获\n\n\nerror:$error\n:$stack\n\n\n\n');
// }
}
CrashTool.crashGlobalWithType(
content: stack.toString(), error: error.toString());
}
}
介绍Dart语言特性
在Dart中,一切都是对象,所有的对象都是继承自Object
Dart是强类型语言,但可以用var或 dynamic来声明一个变量,Dart会自动推断其数据类型,dynamic类似c#
没有赋初值的变量都会有默认值null
Dart支持顶层方法,如main方法,可以在方法内部创建方法
Dart支持顶层变量,也支持类变量或对象变量
Dart没有public protected private等关键字,如果某个变量以下划线(_)开头,代表这个变量在库中是私有的
介绍flutter
1:路由管理Navigator、Get
边栏推荐
- Cholesterol-PEG-FITC, Fluorescein-PEG-CLS, Cholesterol-PEG-Fluorescein water-soluble
- C# Call AutoNavi Map API to obtain latitude, longitude and positioning [Detailed 4D explanation with complete code]
- 【毕业设计】远程智能浇花灌溉系统 - stm32 单片机 嵌入式 物联网
- 【学习笔记】线性规划对偶定理
- EastWave应用:负折射现象实时演示
- Ince-Gaussian模式
- 开源汇智创未来 | 软通动力出席开放原子全球开源峰会OpenAtom openEuler分论坛
- 老生常谈:面试必问“三次握手,四次挥手”这么讲,保证你忘不了
- The fertile soil cloud innovation plan is coming
- 5. 内部类
猜你喜欢

How long does it take to train a neural network, neural network training takes too long

开源汇智创未来 | 软通动力出席开放原子全球开源峰会OpenAtom openEuler分论坛

HyperLynx(五)反射仿真

Summary of darknet structures

使用函数计算打包下载OSS文件【遇坑锦集】

如何在游戏中实现一场下雨效果

PerfView project (first) : how to find hot spots function

Azure IoT & NVIDIA Jetson 开发基础

放苹果

SDS Observatory
随机推荐
chrome is set to dark mode (including the entire webpage)
VirtualLab:Ince-Gaussian光束产生涡旋阵列激光束的观测
a-upload上传图片去掉预览icon
Configuring vim(12) from scratch - theme configuration
I got the P8 "top" distributed architecture manual that went viral on Ali's intranet
文献阅读(185)Co-design
黑马瑞吉外卖之公共字段自动填充
Cholesterol-PEG-FITC, Fluorescein-PEG-CLS, Cholesterol-PEG-Fluorescein water-soluble
darknet 结构体汇总
scala 高级
1. 类与对象——什么是对象
使用函数计算打包下载OSS文件【遇坑锦集】
微信小游戏是个人尝试做游戏最好的选择
go语言学习:并发编程(定时器/select/并发安全锁)
requestAnimationFrame的应用
LeetCode · Question of the Day · 1417. Reformatting String · Simulation
Web3 Entrepreneur's Guide: How to Build a Decentralized Community for Your Product?
【毕业设计】老人心率脉搏血压体征监测手表 - stm32 单片机 嵌入式 物联网
自动售货机
leetcode:373. 查找和最小的 K 对数字