2021-03-09

flutter 2.0 更新内容

稳定的web端支持

网页
截止到今天,Flutter的网络支持已经从Beta过渡到稳定渠道。在此初始稳定版本中,Flutter在Web平台的支持下将代码的可重用性提高到另一个层次。因此,现在当您稳定地创建Flutter应用程序时,Web只是该应用程序的另一个设备目标。

2021-03-09

dart语言-空安全

原文:
Sound Null Safety
Sound null safety is a significant addition to the Dart language, which further strengthens the type system by distinguishing nullable types from non-nullable types. This enables developers to prevent null error crashes, a common reason for apps to crash. By incorporating null checks into the type system, these errors can be caught during development, thus preventing crashes in production. Sound null safety is fully supported in stable as of Flutter 2, which contains Dart 2.12. For more details, see the Dart 2.12 blog post.
The pub.dev package repository already has more than 1,000 null safe packages published, including hundreds of packages by the Dart, Flutter, Firebase, and Material teams. If you are a package author, review the migration guide and consider migrating today.

大致的意思就是空安全,防止系统因为空指针而导致的崩溃。

桌面稳定版即将支持

添加了ReorderableListView 部件,长按拖动item的一种。

平台自适应应用程序

Flutter Folio 具体再google了解一下

Google Mobile Ads to Beta

fluuter 广告的sdk

IOS风格小部件

CupertinoSearchTextField IOS搜索栏部件
该CupertinoFormSection,CupertinoFormRow和CupertinoTextFormFieldRow部件更容易产生与iOS的分段式视觉美学验证表单字段。
2021-03-09

新的小部件

此版本的Flutter附带了两个附加的新小部件,即AutocompleteCore和ScaffoldMessenger。AutocompleteCore表示将自动完成功能纳入Flutter应用程序所需的最低功能。

final messenger = ScaffoldMessenger.of(context);
messenger.showSnackBar(SnackBar(content: Text(‘I can fly.’)));

Flutter Fix 自动修复

这个Flutter Fix 我看了下,能1.x版本api自动转换成2.0新的api,具体命令行操作,也可以使用idea自动操作
Even if you’re familiar with all of the many Flutter deprecations, the larger the number of changes you have to make in your code, the harder it is for you to apply all of the fixes and the easier it is to make mistakes; humans are not great at these kinds of repetitive tasks. But computers are; by executing the following command, you can see all of the fixes we know how to make across your entire project:
$ dart fix --dry-run
If you’d like to apply them in bulk, you can easily do so:
$ dart fix --apply

工具扩展 Android Studio / IntelliJ扩展

工具扩展 VSCode

经过两年的开发,对Dart的LSP(语言服务器协议)支持现已作为默认的方式推出,该方法是将Dart分析器集成到Flutter扩展的Visual Studio Code中的方法。LSP支持对Flutter开发进行了许多改进,包括能够在当前Dart文件中应用某种类型的所有修复程序,并使代码完成生成完整的函数调用(包括括号和必需的参数)的功能。

生态系统更新

Flutter的开发经验不仅包含框架和工具,还包括其他内容。它还包括适用于Flutter应用程序的各种软件包和插件。自上一次Flutter稳定版本发布以来,该领域也发生了很多事情。例如,在摄像机和video_player插件之间,已合并了将近30个PR,以大大提高两者的质量。如果您以前在使用这两种方法时遇到麻烦,则应该再看一遍;我们认为您会发现它们更加强大。
另外,如果你是一个火力地堡的用户,我们很高兴地宣布,最流行的插件已被带到生产质量,包括空安全的支持,以及全套的参考文档和常见的使用教程使用Android,iOS,网页,和macOS。这些插件包括:

验证
云消防站
云功能
云消息传递
云储存
速溶药
另外,如果您正在寻找应用程序的崩溃报告,则可能需要考虑Sentry,该公司已经发布了适用于Flutter应用程序的新SDK。
图片发布图片发布
Sentry崩溃报告工具现在支持Flutter
借助Sentry的Flutter SDK,您可以实时收到在Android,iOS或本机平台上发生的错误的通知。您可以在Sentry文档中查看详细信息。
此外,如果您还没有看到Flutter Community的“ plus”插件,则需要将其签出。他们分叉了Flutter团队最初开发的许多受欢迎的插件,并添加了null安全支持,对其他平台的支持和一整套全新的文档,以及开始修复flutter / plugins存储库中的适当问题。该插件包括以下内容:
Android闹钟+
Android Intent +
电池+
连通性+
设备信息+
网络信息+
套餐信息+
传感器+
分享+
此时,与Flutter兼容的软件包和插件集的数量超过15,000,这使得很难找到您应该首先考虑的软件包和插件。因此,我们会发布发布点数(静态分析得分),受欢迎程度,喜欢度,并且,对于特别高的质量,会发布那些特别标记为Flutter Favorite的包装。为了及时应对Flutter 2,我们在收藏夹列表中添加了几个新软件包:
animation_text_kit
bottom_navy_bar
chopper
font_awesome_flutter
flutter_local_notifications
just_audio

重大变化

我们对Flutter 2进行了以下重大更改,其中许多可以使用dart fix命令或所选IDE中的快速修复程序自动缓解:
61366继续播放剪辑行为更改
66700默认FittedBox的clipBehavior为无
68905从Cupertino颜色分辨率API删除nullOk参数
69808从Scaffold.of和ScaffoldMessenger.of删除nullOk,为两者创建
68910从Router.of删除nullOk参数,并使其返回非空值
68911添加maybeLocaleOf到本地化
68736在Media.queryOf删除nullOK
68917从Focus.of,FocusTraversalOrder.of和FocusTraversalGroup.of中删除nullOk参数
68921从Shortcuts.of,Actions.find和Actions.handler中删除nullOk参数
68925从AnimatedList.of和SliverAnimatedList.of中删除nullOk参数
69620从BuildContex中删除不赞成使用的方法
70726从Navigator.of中删除nullOk参数,并添加Navigator.maybeOft
72017删除不推荐使用的CupertinoTextThemeData.brightness
72395.从HoverEvent中删除不建议使用的[PointerEnterEvent,PointerExitEvent]。
72532删除不建议使用的showDialog.child
72890删除不推荐使用的Scaffold.resizeToAvoidBottomPadding
72893删除不赞成使用的WidgetsBinding。[deferFirstFrameReport,allowFirstFrameReport]
72901删除不推荐使用的StatefulElement.inheritFromElement
72903删除不推荐使用的Element方法
73604删除不建议使用的CupertinoDialog
73745从库比蒂诺[Sliver] NavigationBar删除不赞成使用的actionForegroundColor
73746删除不赞成使用的ButtonTheme.bar
73747删除跨度弃用
73748删除弃用的RenderView.scheduleInitialFrame
73749删除不赞成使用的Layer.findAll
75657从Localizations.localeOf删除残留的nullOk参数
74680从Actions.invoke删除nullOk,添加Actions.maybeInvoke

完结

这些信息都是来自官网,我进行了一个删减。如果对你有帮忙,请帮我点赞好吗?谢谢

上一篇:Android性能优化常见问题,分享PDF高清版


下一篇:Flutter的第一次摸索