flutter1.9,flutter20性能
flutter项目升级2.0过程填坑记录
在此之前先推荐看大佬的: 填坑指导
创新互联建站-专业网站定制、快速模板网站建设、高性价比屯留网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式屯留网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖屯留地区。费用合理售后完善,10年实体公司更值得信赖。
iOS需要注意:
1、flutter2.0要求cocoapods 升级到1.9.0
详情看这篇博客
2、原来flutter项目中的podfile文件是旧版本的ccocoapods了,删除podfile和对应的.lock,然后flutter项目重新运行使用它自动生成的podfile文件
3、安装CocoaPods
卸载cocoapods:sudo gem uninstall cocoapods
查看cocoapods版本:pod --version
指定版本安装:
sudo gem install -n /usr/local/bin cocoapods -v 1.9.3(新MacOS系统升级)
不指定版本安装
sudo gem install -n /usr/local/bin cocoapods
说明 :老项目sdk1.17.0===升级到2.0.1,当前所有操作基于win平台
到此为止环境已经准备妥当,正式进入项目修改。
所有的插件都要适配到空安全,插件是否支持均会有对应说明Null safety,适配过程不确定版本的话,可以使用dio: any,适配完事后再在pubspec.lock文件中查看具体的版本修改过来,实在有部分插件没有支持的,参考下面
部分插件在适配空安全的版本放弃维护了,得自行更新或寻找替代,如: flutter_swiper 变为 flutter_swiper_null_safety ,插件更新后要注意项目中的用法是否需要更新
2.1.1: 以前采用的是 provide 插件共享全局数据,现在变化为 provider ,用法改变, 点击参考 ,以防文章丢失,我重复一遍:
比如:
2.1.2: dio版本升级到4.0.0最新版后,部分用法改变
2.2.1
2.2.2
解决方案:
2.2.3
解决方案:
2.2.4
解决方案:
2.2.5
解决方案:
2.2.6
解决方案:
2.2.7
解决方案:
2.2.8
解决方案: child 换为sliver
2.2.8.1
解决方案: 项目目录下: android--app-build.gradle --minSdkVersion改为:18 或者19
2.2.8.2
解决方案: 在pubspec.yarm管理里面添加:publish_to
2.2.8.3
解决方案: video_player升级后字段发生了变化,initialized字段更换为:isInitialized(_controller.value.isInitialized)
2.2.8.4
解决方案:
2.2.8.5
解决方案:
2.2.8.6
解决方案: 方案一:删除ios目录下的Podfile.lock 文件然后重新运行 pod install命令
方案二:删除ios目录下的Podfile.lock与Podfile文件 重新运行flutter run或flutter build ios
方案三:删除ios目录,重新运行 flutter create . 命令,注意有"."这个符号不要忘记
2.2.8.7
这个报错一般对应的就是下面的报错,注意看后面的报错信息,看是哪个插件报错。
解决方案: 把Podfile的版本注释打开,改为platform :ios, '9.0' 或者是更高的版本
全局替换
1.将new List() 替换为[];
2.TextField的inputFormatters:[WhitelistingTextInputFormatter.digitsOnly] 替换为[FilteringTextInputFormatter.digitsOnly]
3.TextField的inputFormatters:[WhitelistingTextInputFormatter(RegExp("[a-z|A-Z|0-9]"))]替换为FilteringTextInputFormatter.allow(RegExp("[a-z|A-Z|0-9]"))
4.Stack组件中overflow: Overflow.visible改为 clipBehavior: Clip.none;overflow: Overflow.clip改为clipBehavior:Clip.hardEdge
5.ListWheelScrollView组件中clipToSize = false改为clipBehavior: Clip.none,clipToSize = true改为 Clip.hardEdge
6.TextField中maxLengthEnforced: true改为maxLengthEnforcement:MaxLengthEnforcement.enforced
7.FlatButton、RaisedButton、OutlineButton的变化: 官方参考
颜色的属性发生了变化,由原来的Color 变为了MaterialStatePropertyColor, 这是未了解决不同状态(pressed、hovered、focused、disabled)下按钮颜色的变化
例如
8.出现如下警告
9.showSnackBar报错误
解决方案: Scaffold换为ScaffoldMessenger
10.textSelectionColor弃用
解决方案:
11.charts_flutter升级后属性报错
解决方案:
12.flutter 真机调试无法访问网络,dio报错
解决方案:
android:
ios:
问题12完整参考
SSAT试题
SSAT考试真题示例
Writing Sample
Questions: 1 (essay response)
Time: 25 minutes
What is measured? Your essay will be used by admission officers to assess your writing skills. The exercise is not scored by SSAT, but a copy of your essay is forwarded to each school you request as a score recipient.
Directions: Read the following topic carefully. Take a few minutes to think about the topic and organize your thoughts before you begin writing. Use the scratch paper and pen provided. Be sure that your handwriting is legible and that you stay within the lines and margins.
Sample Topic: It is better to be safe than sorry.
Assignment: Do you agree or disagree with the topic statement?
Support your position with one or two specific examples from personal experience, the experience of others, current events, history, or literature.
Multiple-choice Test
Each question is followed by five answer choices. After you have selected your answer, find the row on the answer sheet numbered the same as the question, and fill in the circle with the same letter as your answer. Each question has only one correct answer.
Reading Comprehension
Questions: 40 (multiple-choice), based on 6-7 reading passages
Time: 40 minutes
What is measured? Your ability to read quickly and to understand what you read.
Directions: Read the passage carefully and then answer the questions (1-3) about it. For each question, decide on the basis of the passage which one of the choices best answers the question.
We had had a consuming desire to see a pony rider, but somehow or other all that passed us streaked by in the night, and so we heard only a whiz and a hail, and the swift phantom was gone.
But now the driver exclaims, "Here he comes!" Every neck is stretched and every eye strained.
Away across the endless dead level of the prairie a black speck appears against the sky. Soon it becomes a horse and rider, rising and falling, sweeping nearer and nearer, and the flutter of hoofs comes faintly to the ear. Another instant a whoop and hurrah from our upper deck, a wave of the rider's hand, but no reply, and man and horse burst past our excited faces and go winging away like a belated fragment of a storm!
1. At the driver's call, the people became more
disappointed
eager
frightened
puzzled
hysterical
2. The people waiting to see the pony rider were most probably
at a hotel
on a grandstand
on a stagecoach
at a farm
in a theater
3. The land where the people were watching was
flat and treeless
hilly and rocky
desert-like
farmland
cut by deep crevasses
Quantitative (MATH)
Questions: 50 (multiple-choice), in two sections
Time: 30 minutes per section (60 minutes total)
What is measured? Your knowledge of algebra and quantitative concepts.
Directions: Following each problem in this section, there are five suggested answers. Work each problem in your head or in the space provided (there will be space for scratchwork in your test booklet). Then look at the five suggested answers and decide which is best.
4. According to the graph, who owns the most CD's?
Bob Cheryl Linda Marion Mike
5. If 5 + 9 + __ = 6 + 8 + 1, then __ =
1 5 6 8 9
6. If 3/4 of a number is 48, then 1/4 of the same number is
12 16 24 144 192
7. What is the perimeter of an equilateral triangle if one side of the triangle has the same length as the side of a square with an area of 25?
30 20 15 10 5
Verbal
Questions: 60 (30 Synonym, 30 Analogy)
Time: 30 minutes
What is measured? The synonym questions test your vocabulary, and the analogy questions measure your ability to relate ideas to each other logically.
Directions: Each of the following questions (16-20) consists of one word followed by five words or phrases. You are to select the one word or phrase whose meaning is closest to the word in capital letters.
8.fling
rotate hurl arouse pound defy
9. rountine
legal directed unnecessary usual informative
10. prologue
pretense extension introduction
humorous play nonessential part
11. manipulate
release handle stretch make worse keep apart
12.adroit
clever retentive cooperative unhindered arid
Directions: The following questions (21-25) ask you to find relationships between words. For each question, select the answer choice that best completes the meaning of the sentence.
13. Sapling is to tree as cub is to
moose pine goat cedar bear
14. Frame is to building as
hair is to head skull is to jaw skeleton is to body
finger is to hand bone is to marrow
15. Meandering is to river as
winding is to road wandering is to wave scudding is to cloud
chugging is to train rolling is to ship
Flutter Android端集成排坑 - armeabi 适配 & FlutterBoost
Flutter可以算是当下最火热的新技术之一,我现在所在团队也准备将Flutter技术应用到线上工程中。
关于混合工程,官方文档其实写的已经比较清楚了,按着文档走一般问题不大,
但是有一点值得注意的是,Flutter工程引入的库的gradle的 buildTypes 要与原工程保持一致,如果不一致需要手工添加。
进入正题,现在Flutter官方默认只提供armeabi-v7a、arm64-v8a、x86和x86-64,其中x86和x86-64是为模拟器准备的。目前我们使用的SDK大部分只使用了armeabi架构,直接使用我们会遇见找不到 libflutter.so,libapp.so 的情况,所以我们需要对FlutterSDK做一定的改造。
首先我们要了解下Flutter编译产物,因为不同版本产物是不同的,这里我们只针对Flutter 1.9.1-hotfixes来说。除了资源文件之外,Flutter打包会生成两个非常重要的so库,他们分别是 libflutter.so,libapp.so 。其中 libflutter.so 是Flutter的SDK产物而 libapp.so 正是我们编写的dart文件的产物。默认情况下,这两个文件都会出现在armeabi-v7a中,因此我们要作出对应的改造。
libflutter.so 位于FlutterSDK中,这里顺带提一句,除了这对不同CPU架构,它还分为Debug版和Release版,它们的区别在于Debug是为JIT编译方式打造的,体积较大而Release是为AOT编译方式打造的,体积很小。对 libflutter.so 的改造,只要将其移动文件路径即可,运行以下脚本即可,此脚本来自美团分享的Flutter文章。
移动完了 libflutter.so 之后我们打包发现, libapp.so 仍然会出现在armeabi-v7a中,所以第二部我们就是移动 libapp.so 。这个需要更改 flutter.gradle ,我们在 flutter.gradle 的45行可以看到如下定义,它定义了我们的环境。
在524行我们可以看到,abiValue的取值就是根据上述定义值。
所以结论很简单,只要将
private static final String ARCH_ARM32 = "armeabi-v7a";
改为
private static final String ARCH_ARM32 = "armeabi";
就可以完成对与 libflutter.so 的移动。
前期工作我们都做好了,打成aar就非常简单了
直接使用 flutter build aar --target-platform android-arm
打出来后可以解压检查下 libflutter.so,libapp.so 是否都在armeabi文件夹下即可。
说完了armeabi适配问题,这里下说下有关于有关于FlutterBoost的接入。这个东西接入有两点要注意。
在主app内加上即可,常规操作,强制统一support包的版本号
注释flutter.gradle第655行。因为编译过程中,会去初始化插件项目的buildType下面的debug配置,而插件项目下并未配置debug,导致报错。
如果发现文章中有错误或者有更好的解决方案欢迎指正留言,当然如果本篇文章帮助你解决了问题,也不要吝啬你的感谢。谢谢各位。
Flutter打包产物
基于flutter版本1.9.1,低版本区别对待。
lib目录,libflutter.so文件,三个目录armeabi-v7a,x86_64和x86,支持arm平台32和x86的32和64。
asset目录,新增flutter_asset目录,三个文件,dart产物。
lib目录,libflutter.so文件,两个目录armeabi-v7,arm64-v8a,支持arm平台32和64。
asset目录,新增flutter_asset目录。
在release模式,libapp.so替代flutter老版本的一些dart产物,如下。
flutter命令打包生成产物,flutter命令脚本会调用dart命令。
dart的编译模式:
kernel snapshot 模式,开发阶段,isolate_snapshot_data,vm_snapshot_data,kernel_blob_bin是业务数据。
core jit,
生产阶段,dart的一种二进制模式,这是一种aot模式,vm和isolate。
任重而道远
创建flutter项目语言选择
在升级flutter1.9+之后,flutter默认的iOS项目为swift,Android的默认项目为kotlin
在创建时选择语言
名称栏目:flutter1.9,flutter20性能
当前路径:http://abwzjs.com/article/phhehc.html