包阅导读总结
1. 关键词:
– Expo
– Flutter
– Mobile Framework
– React Native
– Choice
2. 总结:
文章探讨了在 Expo 和 Flutter 之间如何为移动项目选择合适的框架,介绍了两者的特点和差异,通过提出十个问题来帮助确定适合特定项目的技术。
3. 主要内容:
– 介绍背景
– 选择移动框架困难,本文旨在提供实用信息。
– 框架简介
– Flutter:由谷歌于 2017 年推出,使用 Dart 语言,可构建多平台应用,性能高、设计统一。
– Expo:基于 React Native 的工具集,使用 JavaScript/TypeScript 和 JSX,生态系统完善。
– 框架理念差异
– Flutter:“写一次,到处运行”,UI 代码平台独立。
– Expo:“学一次,到处写”,开发者懂 React 即可创建原生应用。
– 选择框架的 10 个问题
– 是否有 React/Dart 知识。
– 是否要直接访问原生平台 API。
– 是否要跨平台视觉一致的设计。
– 是否要 Web 版应用。
– 是否要快速原型。
– 是否要用空中更新。
– 是否计划有开发团队。
– 是否要最佳性能。
– 等等。
思维导图:
文章地址:https://thenewstack.io/expo-vs-flutter-how-to-choose-the-right-mobile-framework/
文章来源:thenewstack.io
作者:Simon Grimm
发布时间:2024/8/9 19:52
语言:英文
总字数:2864字
预计阅读时间:12分钟
评分:82分
标签:移动开发,框架比较,Expo,Flutter,React Native
以下为原文内容
本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com
You want to make the right choice for your company’s next mobile project, but it’s hard to find practical information in this debate. Almost every article points to a Flutter or React Native dev shop trying to convince you that their technology is the best. I promise you, this post is different.
In this article, I’ll ask and answer ten actionable questions that will help you identify the right technology for your specific use case so you can confidently say: *”I chose Expo/Flutter because of X, Y, and Z.”*
First, let’s set a quick baseline of Expo and Flutter, and then we can dive into the ten questions that will help you decide between them.
What Is Flutter? What Is Expo?
First of all, Expo is now the recommended framework for React Native. Therefore, we will compare Expo with Flutter, as Expo is the most popular way to build React Native apps.
The simple truth is that Expo and Flutter are both great technologies!
Google introduced Flutter in 2017. It uses the Dart programming language. Flutter is a complete framework that allows you to build mobile, web, and desktop applications from a single codebase. It is known for its high performance and platform-identical design.
Expo is a set of tools and services built around React Native, which was created by Meta. Expo allows you to build mobile apps faster by writing JavaScript/TypeScript and JSX. It is known for its full ecosystem of services that help companies ship and iterate faster.
Flutter and React Native are open source technologies with large communities and ecosystems of tools and libraries.
Flutter follows a “write once, run everywhere” approach, while Expo follows a “learn once, write anywhere” approach.
What is the difference between these philosophies?
- For Flutter, this concept implies that your UI code is platform-independent and looks the same on all platforms. Apps can, in theory, run on every platform, such as embedded devices.
- For Expo, this means every developer who knows React can create platform-native apps using React Native without learning a new programming language.
So you see, both look great from the outside, but the devil is in the details.
And that’s why we need to ask the right questions to choose the right technology for your project.
10 Questions to Choose Between Expo and Flutter
1. Do You Have React/Dart Knowledge?
If you are a web developer with React knowledge, you will feel at home with Expo. Expo uses React Native, which uses React, so you can leverage your existing knowledge to build mobile apps.
This is a significant advantage if you want to get started quickly and avoid learning a new language like Dart or if you already have React packages you want to use in your mobile app.
On the other hand, if you are a Dart developer or have more experience with Flutter than React, you will feel more comfortable with Flutter.
More than answering this question alone is needed to decide, but it can help save time and resources when starting a new project or dealing with challenging requirements.
2. Do You Want To Access Native Platform APIs Directly?
Flutter and Expo allow you to build mobile apps without touching native code. However, they have different approaches to accessing and using native platform APIs.
Take the camera, for example.
In Flutter, the overlay with its controls is rendered by the Flutter framework itself rather than the underlying operating system.
In Expo, the camera is abstracted away, and you can use the expo-camera
package to render the native iOS and Android camera views.
While it looks like a minor difference, it can affect the critical requirements for some projects. You should ask yourself if you want to access the user experience provided by the Google and Apple teams or if you need the user interface to be identical across platforms.
Beyond using existing libraries, you can also write native Expo Modules or Flutter Plugins to access native APIs directly.
However, managing Flutter channels can be more complex than writing Expo modules as you need to set up many files and handlers (which can also get messy) and Expo modules can be easily bootstrapped using the CLI.
Flutter’s ecosystem of plugins is also less extensive than the React Native community’s, so you might have a harder time finding a package that works for you.
So, if you expect to use niche native APIs or want access to new platform features as soon as they are released, you might want to choose Expo.
3. Do You Want Visually Identical Designs Across Platforms?
Flutter apps look and feel the same across all platforms. This is because Flutter uses its own rendering engine Skia in the past, now Impeller on iOS and widgets to draw the UI. This can be a good thing if you want a consistent brand look and feel across platforms, but it comes at the cost of not looking and feeling fully native to each platform.
Why?
Because all Flutter components (or widgets) have a specific, pre-defined styling, when Apple updates the iOS version and controls, Flutter components still render the same UI until the Flutter SDK and your app are updated some weeks/months later.
On the other hand, Expo uses the platform’s native components. This means the components are rendered by the platform itself, and your app will be native on each platform. This can be a good thing if you want to embrace each platform’s design guidelines and behavior.
Also, using platform-native components means having built-in accessibility that is out of the box, which is a big plus for Expo. After all, Google and Apple engineers spent years perfecting their components.
If you want the same design across platforms, choose Flutter. If you want adaptive styling that makes your users feel at home wherever they use your app, you should select Expo.
4. Do You Want a Web Version of Your App?
While Flutter technically allows targeting the web,it is less mature than the mobile version.
Your whole app is rendered in a canvas
, which presents obstacles for SEO and accessibility because screen readers will have a tough time making sense of all the elements within the canvas.
Also, the web version of your app will not look and feel like an actual web app but more like a mobile app running in a browser. Usually, even Flutter developers are no fans of this approach.
On the other hand, Expo can deliver a web version of your app that uses the DOM out of the box. This means you can build a mobile app and have a web version with minimal effort.
Using Expo Router, you get file-based routing and can use the same components for your mobile and web app, resulting in universal applications.
This means you get the best of both worlds: a mobile app that looks and feels like a native app on each platform and a web app that looks and feels like an actual web app.
If you want a web version of your app, you should choose Expo.
5. Do You Want To Prototype Fast?
Flutter’s built-in UI components allow you to build stunning UIs fast. This is especially valuable if you are a solo developer because you can quickly build an MVP that looks like you hired a designer.
The only downside is that using Material Design components while building an app that looks like a native iOS app is a bit more challenging (especially with adaptive styling for both platforms).
People also complain about React Native’s lack of missing UI components. If you want to build a custom UI, you have to build it yourself using the StyleSheet API or add libraries like NativeWind bringing TailwindCSS to React Native or Tamaguito your project.
Overall, you will spend a lot more time figuring out how to build your UI in React Native than in Flutter.
If you need to ship a prototype fast, you should choose Flutter.
6. Do You Want To Use Over-the-Air Updates?
The app store review process has friction. It can take days or sometimes even weeks to get your app reviewed and published. This can be a problem if you need to fix a critical bug or want to push a new feature quickly.
With Expo, you can use EAS Updateto directly send JS updates to your app’s end users. This service allows you to replace non-native pieces (JS, styling code, and assets) in your app without having to submit a new version to the stores.
This is an absolute game changer for major companies with many users. You can fix bugs and push new features quickly without the waiting time and uncertainty of the external review process.
Flutter does not have a built-in over-the-air update feature, given that Flutter apps are compiled into a binary that can’t be easily replaced. However, Shorebirdis a new service that promises the same for Flutter apps in its early days.
Also, the future of other over-the-air update services is unclear since Microsoft announced that the retirement of App Center could be more apparent.
If you plan to push updates to your users frequently or want to fix bugs in production quickly, choose Expo for your next project.
7. Do You Plan To Have a Team of Developers?
Finding or upskilling one developer is easy, but what if you want to scale your app and need a team to support it?
As React dominates the web, almost every web developer has some experience with React. This means you can easily find developers who can work on your Expo project with minimal learning time.
On the other hand, Flutter is a more niche technology simply because Dart is a niche language, while JavaScript is more universal. Flutter is growing in popularity but is still not as broadly adopted as React because of the language limitations. You will need help finding developers who can work on your Flutter project because Dart is practically only used in Flutter projects.
If you want to build a team of developers to support your app for years, choose Expo.
PS: If you want to learn React Native or upskill your team, check out Galaxies. Dev for in-depth React Native video courses.
8. Do You Want the Best Performance?
Almost every article you read tells you Flutter is faster than React Native.
And, sometimes, that’s true. It depends on the app.
Because Flutter uses its rendering engine, it can achieve excellent performance. But they are in the process of migrating from Skia, a mature rendering engine, to Impeller. It’s not clear what the impact on performance will be.
In the past, React Native suffered from the bridge between JavaScript and native code, which made it slower than Flutter. However, with the introduction of TurboModules and the New Architecture, React Native has become much faster (take a look at these performance benchmarks from 2023).
At the time of writing, the new architecture in React Native was not yet the standard, and not all libraries were compatible with it.
On top of that, you can now also use[React Native Skiato use Skia as the rendering engine in your app, which can bring the performance of Expo on par with Flutter.
One question remains, though: do you need the best performance?
If you build a standard app, the performance difference between Flutter and Expo will not be noticeable to end users. Both technologies are fast enough and deliver a great user experience.
However, you might want to choose Flutter for the best performance when building a complex app with heavy animations like Wonderous. That being said, William Candillon – the creator of Skia, recently demonstrated powerful app animations built with React Native.
To decide which technology “wins” performance, we must define how to measure performance. Is it simply speed? Is it the look and feel of scrolling? Crash rate? CPU usage?
Then, you must decide what performance is most important for your use case.
If you Google ” Flutter vs. React Native performance,” you’ll see a bunch of blogs that prefer Flutter. My advice is to be more nuanced and considerate in how you evaluate performance. Without current and objective public benchmarks, it’s impossible to evaluate in a binary way. Make the decision based on your team’s skills and your use case.
9. Do You Want an Ecosystem of Tools To Create, Review, and Submit Your App?
Expo is not only the recommended framework for React Native but also comes with various tools for teams and companies to build, test, and deploy their apps.
Iteration speed is critical when building a mobile app. Expo provides tools like Expo Go to test your app on your phone, Expo CLI to manage your project, and Expo Orbitto collaborate with your team using one-click build launches and simulator management.
Beyond that, you can optionally use the Expo Application Services (EAS):
- EAS Buildto build your app in the cloud, so you don’t have to worry about setting up build environments for iOS and Android.
- EAS Submitto submit your app to the app stores without using Xcode or Android Studio.
- EAS Update to push JS updates to your app directly to your end users.
For Flutter, you can use a service like[Codemagicto build, test, and deploy your app. However, it is less integrated than the Expo ecosystem and requires more setup and configuration.
If you want the best support for building, testing, and deploying your app with powerful automation that integrates with tools like GitHub, you should choose Expo.
10. Do You Want a Future-Safe Technology With an Active Community?
Flutter’s development is powered by Google, which has a reputation [ending projects]. However, it’s a good sign that Google has been actively developing and using Flutter in their apps.
This means that Flutter has a clear roadmap and is actively developed by mostly Google engineers. While the Flutter community is growing, it is still not as big as the React Native community.
What would happen if Google decided to stop developing Flutter? Will the community continue to develop and maintain Flutter? These are questions you should ask yourself when choosing Flutter.
On the other hand, React Native is powered by the community. This means that the community drives the development of React Native and adds new features and updates.
While Meta is still actively developing React Native, the community plays a significant role in the development of React Native. Companies like Microsoft and Shopify are actively contributing to React Native and massive agencies like Software Mansion, Margelo, Infinite Red, and Callstack are building tools and libraries for React Native in combination with the support from Expo.
Even if Meta stopped developing React Native, the community would continue to develop and maintain React Native.
Select Expo if you want to choose a future-safe technology with an active community.
Making Your Choice
Now that you have answered the ten questions, you should better understand which technology to choose for your next project.
Nobody said the choice is easy, right?
If you are still unsure, let me help you with a quick guideline:
You should choose Expo if you:
- Already have React experience or code
- Want to build web and mobile with one code base
- Want to use native platform components
- Need to access the latest native platform APIs
- Want code push
- Plan to build a future-proof app with a big team
You should choose Flutter if you:
- Have existing Dart developers or knowledge
- Need to prototype an interface very fast
- Want visually identical design across platforms
- Want to create “custom” app experiences closer to games
- Focus on desktop or embedded device apps as well
Remember, both technologies are great, and you can build amazing apps. The most important thing is to choose the technology that best fits your use case, stakeholders, and team.
The Future of Flutter and Expo
The future of Flutter and Expo is bright. Both technologies are actively developed and maintained by their respective communities and companies, and new features and updates are added regularly.
Flutter is growing in popularity and is used by companies like Google, Alibaba, and BMW to build mobile, web, and desktop applications that deliver custom app experiences.
Expo is used by companies like Meta, Microsoft, and Coinbaseto build mobile apps that look and feel like native apps on each platform.
Evan Bacon’s blog also contains an extensive list of apps built with React Native and Flutter].
Overall, more big companies are choosing Expo over Flutter. The trend I’ve observed is that companies use Flutter to build employee experiences where it makes sense to have a visually identical experience across multiple devices for internal apps, and companies use Expo to build consumer experiences. These obviously aren’t absolutes. There are plenty of consumer-facing Flutter apps and internal Expo apps.
But if you’re building an app that you think could scale to the masses, you are better off with Expo, as you can quickly scale your app and team with Expo.
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don’t miss an episode. Subscribe to our YouTubechannel to stream all our podcasts, interviews, demos, and more.