Flutter2.0更新摘要

作者: 小源子2016 | 来源:发表于2021-03-19 11:06 被阅读0次

    一 .适应了更多的平台,尤其是Web

    Platform Adaptive Apps: Flutter Folio Sample

    Now that Flutter supports three platforms for production apps (Android, iOS, and the web) and three more in beta (Windows, macOS, and Linux)

    二 .增加了空安全的机制

    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.

    三 .重大改变升级帮助

    一些过时的Api改成新的Api,可以试试这个。但是第三方SDK我想是个麻烦的事情

    $ dart fix --dry-run

    四.代码错误检查与修复建议

    One new feature that helps you zero in on your issues even before you’ve launched DevTools is the ability for Android Studio, IntelliJ, or Visual Studio Code to notice when there’s a common exception and offer to bring it up in DevTools to help you debug it. For example, the following shows an overflow exception has been thrown in your app, which brings up an option in Visual Studio Code to debug the issue in DevTools.

    五.App性能调试

    Another new feature in DevTools is the ability to easily see an image that’s at a higher resolution than it’s displayed, which helps track down excessive app size and memory usage. To enable this feature, enable the Invert Oversized Images in the Flutter Inspector

    重大更新如下

    Breaking Changes

    We’ve made the following breaking changes for Flutter 2, many of which can be automatically mitigated using the dart fix command or the quick fixes in your IDE of choice:

    61366 Continue the clipBehavior breaking change

    66700 Default FittedBox’s clipBehavior to none

    68905 Remove nullOk parameter from Cupertino color resolution APIs

    69808 Remove nullOk from Scaffold.of and ScaffoldMessenger.of, create maybeOf for both

    68910 Remove nullOk parameter from Router.of and make it return a non-nullable value

    68911 Add maybeLocaleOf to Localizations

    68736 Remove nullOK in Media.queryOf

    68917 Remove nullOk parameter from Focus.of, FocusTraversalOrder.of, and FocusTraversalGroup.of

    68921 Remove nullOk parameter from Shortcuts.of, Actions.find, and Actions.handler

    68925 Remove nullOk parameter from AnimatedList.of and SliverAnimatedList.of

    69620 Remove deprecated methods from BuildContex

    70726 Remove the nullOk parameter from Navigator.of and add Navigator.maybeOft

    72017 Remove deprecated CupertinoTextThemeData.brightness

    72395 Remove deprecated [PointerEnterEvent, PointerExitEvent].fromHoverEvent

    72532 Remove deprecated showDialog.child

    72890 Remove deprecated Scaffold.resizeToAvoidBottomPadding

    72893 Remove deprecated WidgetsBinding.[deferFirstFrameReport, allowFirstFrameReport]

    72901 Remove deprecated StatefulElement.inheritFromElement

    72903 Remove deprecated Element methods

    73604 Remove deprecated CupertinoDialog

    73745 Remove deprecated actionsForegroundColor from Cupertino[Sliver]NavigationBar

    73746 Remove deprecated ButtonTheme.bar

    73747 Remove span deprecations

    73748 Remove deprecated RenderView.scheduleInitialFrame

    73749 Remove deprecated Layer.findAll

    75657 Remove vestigial nullOk parameter from Localizations.localeOf

    74680 Remove nullOk from Actions.invoke, add Actions.maybeInvoke

    相关文章

      网友评论

        本文标题:Flutter2.0更新摘要

        本文链接:https://www.haomeiwen.com/subject/iklvcltx.html