App、H5、PC应用多端开发框架Flutter 2发布

Google于2021年3月3日发布跨平台多端框架Flutter 2。

针对web,移动和台式机构建的下一代Flutter。

Flutter框架已经推出有两年了,但是之前一直在移动端App发力,慢慢发展到了PC端。在window电脑的应用程序和mac电脑的应用程序。

现在Flutter 2 专门面向了web端(电脑浏览器网页、手机浏览器h5页面)、当然小程序这类框架慢慢兼容Flutter框架也会变成大势所趋。

这对我们来说意味着什么?

以后开发一套程序在多个平台上运行的理想,成为越来越可行越来越现实。

研发周期缩短和研发成本再一次降低。

当然一项新技术从发布到普及、是需要几年甚至十几年的发展,不是一下子就能马上应用到市场上,是需要技术的不断完善,适应更多场景,需要时间来让更多相关技术的兼容和配合。研发人员对新技术的学习以及熟练。

当然Flutter 2 也是开源技术。

下面是官方网站的一些介绍。

Announcing Flutter 2

Wednesday, March 3, 2021

Our next generation of Flutter, built for web, mobile, and desktop

Today, we’re announcing Flutter 2: a major upgrade to Flutter that enables developers to create beautiful, fast, and portable apps for any platform. With Flutter 2, you can use the same codebase to ship native apps to five operating systems: iOS, Android, Windows, macOS, and Linux; as well as web experiences targeting browsers such as Chrome, Firefox, Safari, or Edge. Flutter can even be embedded in cars, TVs, and smart home appliances, providing the most pervasive and portable experience for an ambient computing world.

宣布Flutter 2发布

2021年3月3日,星期三

我们的下一代Flitter,专为web、移动和桌面而设计。

今天,我们要宣布的是Flutter 2:它是对Flutter 的一个重大升级,它使开发人员能够为任何平台创建漂亮、快速和可移植的应用程序。使用Flutter 2,您可以使用相同的代码库将本机应用程序发送到五个操作系统:iOS、Android、Windows、macOS和Linux;以及针对Chrome、Firefox、Safari或Edge等浏览器的web体验。Flutter甚至可以嵌入到汽车、电视和智能家电中,为周围的计算世界提供最普及和便携的体验。

image 1.png

Our goal is to fundamentally shift how developers think about building apps, starting not with the platform you’re targeting but rather with the experience you want to create. Flutter allows you to handcraft beautiful experiences where your brand and design comes to the forefront. Flutter is fast, compiling your source to machine code, but thanks to our support for stateful hot reload, you still get the productivity of interpreted environments, allowing you to make changes while your app is running and see the results immediately. And Flutter is open, with thousands of contributors adding to the core framework and extending it with an ecosystem of packages.

我们的目标是从根本上改变开发人员对构建应用程序的想法,不是从你目标的平台开始,而是从你想要创建的体验开始。Flutter 让你手工制作美丽的体验,你的品牌和设计走到了最前沿。Flutter 速度很快,可以将源代码编译为机器代码,但由于我们支持有状态热重新加载,您仍然可以获得解释环境的生产力,允许您在应用程序运行时进行更改并立即查看结果。Flutter 是开放的,成千上万的贡献者加入到核心框架中,并用一个包的生态系统来扩展它。

image 2.png

In Flutter 2, released today, we’ve broadened Flutter from a mobile framework to a portable framework, unleashing your apps to run on a wide variety of different platforms with little or no change. There are already over 150,000 Flutter apps out there on the Play Store alone, and every app gets a free upgrade with Flutter 2 because they can now grow to target desktop and web without a rewrite.

Customers from all around the world are using Flutter, including popular apps like WeChat, Grab, Yandex Go, Nubank, Sonos, Fastic, Betterment and realtor.com. Here at Google, we’re depending on Flutter, and over a thousand engineers at Google are building apps with Dart and Flutter. In fact, many of those products are already shipping, including Stadia, Google One, and the Google Nest Hub.

在今天发布的Flutter 2中,我们将Flutter 从一个移动框架扩展到了一个可移植的框架,使您的应用程序可以在各种不同的平台上运行,几乎没有变化。仅在Play Store上就已经有超过150000个Flutter 应用程序,每个应用程序都可以免费升级到Flutter 2,因为它们现在可以扩展到桌面和web而无需重写。

来自世界各地的客户都在使用Flutter ,包括微信、Grab、Yandex Go、Nubank、Sonos、Fastic、Betterment和realtor.com. 在谷歌,我们依赖Flutter,谷歌的一千多名工程师正在用Dart和Flutter构建应用程序。事实上,这些产品中的许多已经开始出货,包括Stadia、googleone和googlenest Hub。

image 3.png

Google Pay switched to Flutter a few months ago for their flagship mobile app, and they already achieved major gains in productivity and quality. By unifying the codebase, the team removed feature disparity between platforms and eliminated over half a million lines of code. Google Pay also reports that their engineers are far more efficient, with a huge reduction in technical debt and unified release processes such as security reviews and experimentation across both iOS and Android.

几个月前,谷歌支付(googlepay)为其旗舰手机应用改用Flutter,他们已经在生产率和质量上取得了重大进展。通过统一代码库,团队消除了平台之间的特性差异,消除了超过50万行代码。谷歌支付(googlepay)还报告称,他们的工程师效率要高得多,技术债务大幅减少,iOS和Android的安全审查和实验等统一发布流程。

Flutter on the web

Perhaps the single largest announcement in Flutter 2 is production-quality support for the web.

The early foundation of the web was document-centric. But the web platform has evolved to encompass richer platform APIs that enable highly sophisticated apps with hardware-accelerated 2D and 3D graphics and flexible layout and paint APIs. Flutter’s web support builds on these innovations, offering an app-centric framework that takes full advantage of all that the modern web has to offer.

基于Web的Flutter

也许Flutter 2中最大的一个声明就是对web的生产质量支持。

Web的早期基础是以文档为中心的。但是,web平台已经发展到包含更丰富的平台api,这些api支持具有硬件加速的2D和3D图形以及灵活的布局和绘制api的高度复杂的应用程序。Flutter的web支持基于这些创新,提供了一个以应用程序为中心的框架,充分利用了现代web所提供的一切。

This initial release focuses on three app scenarios in particular:

  • Progressive web apps (PWAs) that combine the web’s reach with the capabilities of a desktop app.
  • Single page apps (SPAs) that load once and transmit data to and from internet services.
  • Bringing existing Flutter mobile apps to the web, enabling shared code for both experiences.

此初始版本特别关注三种应用程序场景:

渐进式web应用程序(PWA),将web的覆盖范围与桌面应用程序的功能结合起来。

单页应用程序(spa),只需加载一次,就可以在互联网服务之间传输数据。

将现有的flatter移动应用程序引入网络,实现两种体验的共享代码。

In the last months, as we prepared for the stable release of web support, we made lots of progress on performance optimization, adding a new CanvasKit-powered rendering engine built with WebAssembly. Flutter Plasma, a demo built by community member Felix Blaschke, showcases the ease of building sophisticated web graphics experiences with Dart and Flutter that can also run natively on desktop or mobile devices.

在过去的几个月里,当我们准备稳定发布web支持时,我们在性能优化方面取得了很大的进展,添加了一个新的CanvasKit驱动的渲染引擎,该引擎由WebAssembly构建。Flutter Plasma是社区成员Felix Blaschke制作的一个演示,它展示了用Dart和Flutter构建复杂的web图形体验的简易性,这种体验也可以在桌面或移动设备上本地运行。

We’ve been extending Flutter to offer the best of the web platform. In recent months, we added text autofill, control over address bar URLs and routing, and PWA manifests. And because desktop browsers are as important as mobile browsers, we added interactive scrollbars and keyboard shortcuts, increased the default content density in desktop modes, and added screen reader support for accessibility on Windows, macOS, and Chrome OS.

我们一直在扩展Flutter以提供最好的web平台。最近几个月,我们添加了文本自动填充、地址栏URL和路由控制以及PWA清单。由于桌面浏览器和移动浏览器一样重要,我们增加了交互式滚动条和键盘快捷键,增加了桌面模式下的默认内容密度,并增加了对Windows、macOS和Chrome操作系统的屏幕阅读器支持。

Some examples of web apps built with Flutter are already available. Among educators, iRobot is well known for their popular Root educational robots. Flutter’s production support for the web allows iRobot to take their existing educational programming environment and move it to the web, expanding its availability to Chromebooks and other devices where the browser is the best choice. iRobot’s blog post has all the details on their progress so far and why they chose Flutter.

一些用Flutter 构建的web应用程序的例子已经出现了。在教育工作者中,iRobot以其广受欢迎的根教育机器人而闻名。Flitter对web的生产支持使iRobot能够利用其现有的教育编程环境并将其移动到web上,从而将其可用性扩展到Chromebooks和其他浏览器是最佳选择的设备。iRobot的博客文章详细介绍了他们目前的进展以及为什么选择了Flitter。

image 4.png

Another example is Rive, who offers designers a powerful tool for creating custom animations that can ship to any platform. Their updated web app, now available in beta, is built entirely with Flutter, and is a love letter to all that Flutter can offer in this environment.

另一个例子是Rive,他为设计师提供了一个强大的工具,用于创建可以发布到任何平台的自定义动画。他们最新的web应用程序,现在可以在beta版中使用,完全是用Flutter构建的,是对Flutter在这个环境中所能提供的一切的一封情书。

image 5.png

You can find out more about Flutter on the web from our dedicated blog post over at our Medium publication.

Flutter 2 on desktops, foldables, and embedded devices

Beyond traditional mobile devices and the web, Flutter is increasingly stretching out to other device types, and we highlighted three partnerships in today’s keynote that demonstrate Flutter’s portability.

你可以在我们的媒体出版物上找到更多关于颤振的信息。

台式机、可折叠和嵌入式设备上的Flutter 2

除了传统的移动设备和网络之外,Flutter 正越来越多地扩展到其他设备类型,我们在今天的主题演讲中重点介绍了三种合作关系,它们展示了Flutter 的可移植性。

To start with, Canonical is partnering with us to bring Flutter to desktop, with engineers contributing code to support development and deployment on Linux. During today’s event, the Ubuntu team showed an early demo of their new installer app that was rewritten with Flutter. For Canonical, it is critical that they can deliver rock-solid yet beautiful experiences on a huge variety of hardware configurations. Moving forward, Flutter is the default choice for future desktop and mobile apps created by Canonical.

首先,Canonical正与我们合作,将Flutter带到桌面上,由工程师贡献代码来支持Linux上的开发和部署。在今天的活动中,Ubuntu团队展示了他们新安装的应用程序的早期演示,这个应用程序是用flatter重写的。对于Canonical来说,关键是他们能够在各种各样的硬件配置上提供坚如磐石而又美丽的体验。向前看,Flutter 是Canonical创建的未来桌面和移动应用程序的默认选择。

image 6.png

Secondly, Microsoft is continuing to expand its support for Flutter. In addition to an ongoing collaboration to offer high-quality Windows support in Flutter, today Microsoft is releasing contributions to the Flutter engine that support the emerging class of foldable Android devices. These devices introduce new design patterns, with apps that can either expand content or take advantage of the dual-screen nature to offer side-by-side experiences. In a blog post from the Surface engineering team, they demonstrate their work and invite others to join them in completing a high-quality implementation that works on Surface Duo and other devices.

其次,微软正在继续扩大对Flutter 的支持。除了正在进行的在Flutter 中提供高质量Windows支持的合作之外,今天微软正在发布对Flutter 引擎的贡献,以支持新兴的可折叠Android设备。这些设备引入了新的设计模式,应用程序既可以扩展内容,也可以利用双屏特性提供并排体验。在Surface engineering团队的一篇博客文章中,他们展示了自己的工作,并邀请其他人加入他们的行列,完成了一个在Surface Duo和其他设备上工作的高质量实现。

Lastly, Toyota, the world’s best-selling automaker, announced its plans to bring a best-in-market digital experience to vehicles, by building infotainment systems powered by Flutter. Using Flutter marks a large departure in approach from how in-vehicle software has been developed in the past. Toyota chose Flutter because of its high performance and consistency of experience, fast iteration and developer ergonomics as well as smartphone-tier touch mechanics. By using Flutter’s embedder API, Toyota is able to tailor Flutter for the unique needs of an in-vehicle system.

最后,世界上最畅销的汽车制造商丰田宣布,计划通过建立由Flutter驱动的信息娱乐系统,为汽车带来市场上最好的数字体验。使用颤振标志着在方法上与过去开发车载软件的方式有很大的不同。丰田选择颤振是因为它的高性能和一致性的经验,快速迭代和开发人体工程学以及智能手机层触摸力学。通过使用颤振的嵌入API,丰田能够定制颤振的独特需求的车内系统。

image 8.png

We’re excited to continue our work with Toyota and others to bring Flutter to vehicles, TVs, and other embedded devices, and we hope to share further examples in the coming months.

我们很高兴能继续与丰田和其他公司合作,为汽车、电视和其他嵌入式设备带来Flutter ,我们希望在未来几个月内分享更多的例子。

The growing Flutter ecosystem

There are now over 15,000 packages for Flutter and Dart: from companies like Amazon, Microsoft, Adobe, Alibaba, eBay, and Square; to key packages like Lottie, Sentry and SVG, as well as Flutter Favorite packages such as sign_in_with_apple, google_fonts, geolocator, and sqflite.

Today we’re announcing the beta release of Google Mobile Ads for Flutter, a new SDK that works with AdMob and AdManager to offer a variety of ad formats, including banner, interstitial, native, and rewarded video ads. We’ve been piloting this SDK with several key customers, such as Sua Música, the largest music platform for independent artists in Latin America, and we’re now ready to open the Google Mobile Ads for Flutter SDK for broader adoption.

成长中的Flutter生态系统

目前,Flutter和Dart的软件包已超过15000个:从亚马逊、微软、Adobe、阿里巴巴、eBay和Square等公司;到Lottie、Sentry和SVG等关键软件包,以及Flutter最喜欢的软件包,如sign\u in\u with\u apple、google\u fonts、geolocator和sqflite。

今天,我们将发布针对Flutter的Google移动广告beta版,这是一个新的SDK,与AdMob和AdManager合作,提供多种广告格式,包括横幅广告、插页广告、原生广告和奖励视频广告。我们已经与几个主要客户一起试用了这个SDK,比如Sua Música,这是拉丁美洲最大的独立艺术家音乐平台,现在我们已经准备好为Flutter SDK打开谷歌移动广告,以便更广泛地采用。

image 9.png

We’re also announcing updates to our Flutter plug-ins for several core Firebase services: Authentication, Cloud Firestore, Cloud Functions, Cloud Messaging, Cloud Storage, and Crashlytics, including support for sound null safety and an overhaul of the Cloud Messaging package.

我们还宣布了几个核心Firebase服务的flatter插件的更新:身份验证、云Firestore、云功能、云消息传递、云存储和Crashlytics,包括对声音空安全的支持和云消息传递包的大修。

Dart: The secret sauce behind Flutter

As we’ve noted, Flutter 2 is portable to many different platforms and form factors. The easy transition to supporting web, desktop, and embedded is thanks in large part to Dart, Google’s programming language that is optimized for multiplatform development.

Dart:Flutter背后的秘密

正如我们所注意到的,Flutter2是可移植到许多不同的平台和形式因素。向支持web、桌面和嵌入式的轻松过渡在很大程度上要归功于Dart,这是一种为多平台开发而优化的Google编程语言。

Dart combines a unique set of capabilities for building apps:

  • No-surprise portability, with compilers that generate high-performance Intel and ARM machine code for mobile and desktop, as well as tightly optimized JavaScript output for the web. The same Flutter framework source code compiles to all these targets.
  • Iterative development with stateful hot reload on desktop and mobile, as well as language constructs designed for the asynchronous, concurrent patterns of modern UI programming.
  • Google-class performance across all of these platforms, with sound null safety guaranteeing null constraints at runtime as well as during development.

Dart结合了一组独特的功能来构建应用程序:

可移植性不足为奇,编译器可以为移动和桌面生成高性能的Intel和ARM机器代码,还可以为web生成经过严格优化的JavaScript输出。相同的颤振框架源代码编译到所有这些目标。

在桌面和移动设备上使用有状态热加载的迭代开发,以及为现代UI编程的异步并发模式设计的语言结构。

Google在所有这些平台上都有一流的性能,良好的空安全性保证了运行时和开发期间的空约束。

There’s no other language that combines all these capabilities; perhaps this is why Dart is one of the fastest growing languages on GitHub.

Dart 2.12, available today, is our largest release since 2.0, with support for sound null safety. Sound null safety has the potential to eradicate dreaded null reference exceptions, offering guarantees at development and runtime that types can only contain null values if the developer expressly chooses. Best of all, this feature isn’t a breaking change: you can incrementally add it to your code at your own pace, with migration tooling available to help you when you’re ready.

Today’s update also includes a stable implementation of FFI, allowing you to write high-performance code that interoperates with C-based APIs; new integrated developer and profiler tooling written with Flutter; and a number of performance and size improvements that further upgrade your code for no cost other than a recompile. For more information, check out the dedicated Dart 2.12 announcement blog post.

没有其他语言结合了所有这些功能;也许这就是为什么Dart是GitHub上增长最快的语言之一。

Dart 2.12是我们自2.0以来最大的版本,支持声音零安全。健全的空安全性有可能消除可怕的空引用异常,在开发和运行时提供保证,即只有在开发人员明确选择的情况下,类型才能包含空值。最重要的是,这个特性并不是一个突破性的变化:您可以按照自己的速度将它添加到代码中,并在准备就绪时提供迁移工具来帮助您。

今天的更新还包括FFI的稳定实现,允许您编写与基于C的api互操作的高性能代码;使用Flutter编写的新的集成开发人员和探查器工具;以及一些性能和大小改进,这些改进除了重新编译之外,还可以免费进一步升级您的代码。有关更多信息,请查看专用的Dart 2.12发布博客文章。

Flutter 2: Available now

There’s far more to say about Flutter 2 than we can include in this article. In fact, the raw list of pull requests merged is a 200 page document! Head over to the separate technical blog on Flutter 2 for more information about the many new features and performance improvements that we think will please existing Flutter developers, and download it today.

Flutter 2:现在可用

关于Flutter 2,我们要说的远不止本文中所包含的内容。事实上,合并的pull请求的原始列表是一个200页的文档!请访问flutrax2上的独立技术博客,了解更多关于许多新特性和性能改进的信息,我们认为这些新特性和性能改进将使现有的Flutter 开发人员感到满意,请立即下载。

image 10.png

We also have a major new sample that showcases everything we just mentioned, built in collaboration with gskinner, an award-winning design team based in Edmonton, Canada. Flutter Folio is a scrapbooking app that is designed for all your devices. The small-screen experience is designed for capturing content; larger screens support editing with desktop- and tablet-specific idioms; and the web experience is tailored for sharing. All these tailored experiences share the same codebase, which is open source and available for you to peruse.

我们还有一个主要的新样品,展示了我们刚才提到的一切,建立在与gskinner,一个获奖的设计团队在加拿大埃德蒙顿的合作。Flutter Folio是一款剪贴簿应用程序,专为您的所有设备设计。小屏幕体验是为捕获内容而设计的;大屏幕支持使用特定于桌面和平板电脑的习惯用法进行编辑;网络体验是为共享而定制的。所有这些定制的体验共享相同的代码库,这是开源的,可供您阅读。

image 11.png

If you haven’t yet tried Flutter, we think you’ll find it to be a major upgrade for your app development experience. In Flutter, we’re offering an open source toolkit for building beautiful and fast apps that target mobile, desktop, web, and embedded devices from a single codebase, built both to solve Google’s demanding needs and those of our customers.

Flutter is free and open source. We’re excited to see what you build with Flutter 2!

如果您还没有尝试Flutter,我们认为您会发现它是您应用程序开发体验的一个重大升级。在Flutter中,我们提供了一个开源工具包,用于构建漂亮而快速的应用程序,这些应用程序的目标是移动、桌面、web和嵌入式设备,这些应用程序都是从一个单独的代码库构建的,这些代码库是为了解决Google的苛刻需求和我们客户的需求。

Flutter 是免费的和开源的。我们很高兴看到你Flutter 2构建了什么!

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 151,829评论 1 331
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 64,603评论 1 273
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 101,846评论 0 226
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 42,600评论 0 191
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 50,780评论 3 272
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 39,695评论 1 192
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,136评论 2 293
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 29,862评论 0 182
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 33,453评论 0 229
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 29,942评论 2 233
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,347评论 1 242
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 27,790评论 2 236
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,293评论 3 221
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 25,839评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,448评论 0 181
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 34,564评论 2 249
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 34,623评论 2 249

推荐阅读更多精彩内容