Flutter VS React Native –为什么我认为Flutter最适合移动应用程序开发

This isn’t the type of article you might think it’s going to be. I’m not going to list the pros and cons of every framework and I am not going to do a comparative analysis of performance.

这不是您可能会想到的文章类型。 我不会列出每个框架的优缺点,也不会对性能进行比较分析。

Over the past few weeks, I have dipped my coding hand in trying to create simple, functional applications using both frameworks. The title of this article is the conclusion I have come to from my experimentation.

在过去的几周中,我竭尽全力尝试使用这两个框架创建简单的功能性应用程序。 本文的标题是我从实验中得出的结论。

⚠️ Disclaimer: I am in no way stating that framework A is better than framework B and I have not been paid by neither to give my opinion. This is solely an article based on my personal experience and nothing more.

Dis️免责声明:我绝不说框架A比框架B更好,而且我也没有给我任何意见。 这只是一篇基于我个人经验的文章,仅此而已。

一些背景 (Some Background)

While I am not familiar with either Dart or React, I have some background in JavaScript and more than my fair share of Native development. Since these two frameworks are relatively new and are offering the same type of development experience, I thought I’d give them a try to see what the whole fuss is about. Granted, I am not profoundly adept in the whole logic of both and I have yet to fully understand the state component in React or the component hierarchy in Dart. With that being said, I set out to create a basic application in both platforms. The premise for the application? One that would accept user input, and on a touch of a button will display the user input in some sort of list that the user can scroll through on the screen.

尽管我对Dart或React都不熟悉,但我对JavaScript有一定的了解,并且对本机开发有相当的了解。 由于这两个框架相对较新,并且提供了相同类型的开发经验,所以我认为我将尝试尝试一下整个过程。 当然,我对这两者的整体逻辑并不十分精通,并且我还没有完全理解React中的状态组件或Dart中的组件层次结构。 话虽如此,我着手在两个平台上创建一个基本应用程序。 申请的前提? 接受用户输入并按一下按钮的用户将以某种列表显示用户输入,用户可以在屏幕上滚动浏览。



我的React (My REACT-ion)

I first started working on the application using React Native. Setting up the project was very simple. All you had to do was follow through on the instructions in the Getting Started documentation. I installed Expo and within minutes, my application was loading on my phone. I really appreciated the speed in which the QR code scanner of the Expo application identifies the code on the screen. Expo’s interface on the computer was also really straight forward. You can see the status of the application (building or failing), boot up an Android/iOS emulator and more. Now it was time to put my own logic into the application. This is where things got frustrating.

我首先开始使用React Native来处理应用程序。 设置项目非常简单。 您所要做的就是按照《 入门指南》文档中的说明进行操作。 我安装了Expo,并在几分钟之内将我的应用程序加载到手机上。 我非常感谢Expo应用程序的QR码扫描器在屏幕上识别代码的速度。 Expo在计算机上的界面也非常简单。 您可以查看应用程序的状态(正在构建或正在失败),启动Android / iOS模拟器等。 现在是时候将我自己的逻辑放入应用程序中了。 这就是令人沮丧的地方。

Swapping the View element with a text input was easy, and so was adding a button with an onClick action. But trying to have a data set to save the user input, was down right mind boggling. I made a variable which was an array in the state object and tried various ways to update it when the user finished entering his/her own input. I have searched high and low and implemented various solutions to allow my application to save data to the array, but to no avail. The documentation I did find was sparse and it wasn’t really helpful. Not to mention the plethora of compilation errors I was having, which were not that instructive into what was wrong with my code. After a while, it became quite annoying seeing that red screen repeatedly.

用文本输入交换View元素很容易,添加带有onClick动作的按钮也很容易。 但是试图拥有一个数据集来保存用户输入,却是令人费解的。 我在状态对象中创建了一个变量,该变量是一个数组,并在用户输入完自己的输入后尝试了各种方法对其进行更新。 我搜索了很多内容,并实施了各种解决方案,以使我的应用程序可以将数据保存到阵列,但无济于事。 我确实发现的文档很少,而且并没有真正的帮助。 更不用说我遇到的过多编译错误,这些错误对于我的代码出了什么问题没有启发性。 一段时间后,反复看到红色屏幕变得很烦人。

飘飘 (Fluttering Away)

Being flustered and ashamed I couldn’t make the simplest of applications using React, and following the announcement of Flutter, I thought I’d take a crack building the same application. You know what they say, change of place - change of luck.

由于感到慌乱和羞愧,我无法使用React使最简单的应用程序变得简单,在Flutter发布之后,我认为我会努力构建相同的应用程序。 你知道他们在说什么,地点的改变-运气的改变。

Setup was a breeze and offered the same quick experience React afforded and I was ready to start developing in no time. Downloading the Flutter SDK and installing the plugin were part of just a few simple steps to start developing in Flutter.

设置轻而易举,并提供了React提供的相同的快速体验,我准备立即开始开发。 下载Flutter SDK和安装插件只是开始在Flutter中进行开发的几个简单步骤的一部分。

Next came the task of looking at the code. How can I put it into words? Not what I was expecting. You have different components in a long and winding hierarchy, which at times, can be difficult to keep track of. Apart from that, you have widgets and columns and rows and you need to figure out where everything fits in together. By now, you are thinking I am supposed to tell you why I like Flutter. As most things are, they have their strengths and weaknesses. And after going over the things I think are irritating, I can relish in what I found endearing.

接下来是查看代码的任务。 我该如何用语言表达呢? 不是我所期望的。 您在冗长而曲折的层次结构中具有不同的组件,有时可能难以跟踪。 除此之外,您还具有小部件,列和行,并且需要弄清楚所有内容在哪里组合在一起。 现在,您认为我应该告诉您为什么我喜欢Flutter。 就大多数情况而言,它们各有优缺点。 在审阅了我认为令人讨厌的事物之后,我可以品尝一下我发现的可爱事物。

For starters, Flutter is heavily documented. Every time I had to look up for something, I could easily find it in the documentation. More so, there are so many real life examples of various applications out there, that you are bound to find one similar to something that you are trying to make.

对于初学者来说,Flutter有大量记录 。 每次需要查找时,都可以在文档中轻松找到它。 更重要的是,这里有很多关于各种应用程序的真实示例,您必然会找到与您尝试制作的类似的应用程序。

After tinkering with the starter code, you start to get a hang of the hierarchy, and how views are displayed, that you come to understand the weird intricacies of it all. It was also a blast to realize that making a component behave a certain way was as easy as adding another characteristic to the widget.

修改了入门代码后,您开始了解层次结构,并了解视图的显示方式,从而了解所有这些内容的怪异复杂性。 意识到使组件以某种特定方式工作就像向小部件添加另一个特性一样容易,这也是一个爆炸。

And above all, I was already in a native setting. I was at home with Android Studio, understanding where everything goes and enjoying the luxuries and benefits of a familiar surrounding.

最重要的是, 我已经处于原生环境 。 我在Android Studio的家中,了解一切进展并享受熟悉的环境带来的奢华和好处。

Compared to the time I spent trying to develop my application in React, the time I spent in Flutter was a fraction of that. Plus, even if what you are trying to do doesn’t always work, you get the sense of eventual progress and you are encouraged to look at things in more detail inside the documentation.

比起我花了试图开发我的申请做出React的时候,我在扑花的时间的一小部分。 另外,即使您尝试执行的操作并非总是有效,您仍会感觉到最终的进展,因此鼓励您仔细阅读文档中的内容。

Angry 😠? Upset 🙍? Exhilarated 😂? Jubilant? 🙌 Let me know what you think.

生气😠? 心烦🙍? 😂? 喜庆? 🙌让我知道你的想法。

翻译自: https://www.freecodecamp.org/news/flutter-vs-react-native-and-why-i-think-flutter-is-best-for-mobile-app-development/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/392679.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python 2.7 error: Microsoft Visual C++ 9.0 is required

参考:https://stackoverflow.com/questions/43645519/microsoft-visual-c-9-0-is-required 解决方法: 下载并安装Microsoft Visual C Compiler for Python 2.7: Microsoft Visual C Compiler for Python 2.7 转载于:https://www.cnblogs.com/…

python内置支持集合运算吗_Python中的集合支持交、并运算

Python中的集合支持交、并运算答:√新冠肺炎患者潜伏期的传染性最强答:对在运动的组接中,镜头组接一个基本的原则是()、()。答:动接动 静接静在中指背,距指甲根中点1分许称答:老龙库存控制属于生产管理而不是物流管理的…

C语言递归实现二叉树(二叉链表)的三种遍历和销毁操作(实验)

今天写的是二叉树操作的实验,这个实验有三个部分: ①建立二叉树,采用二叉链表结构 ②先序、中序、后续遍历二叉树,输出节点值 ③销毁二叉树 二叉树的节点结构定义 typedef struct BiTNode //二叉树的节…

OC extern和变量

注意&#xff1a; extern只能用来声明全部变量&#xff0c;不能拿来定义变量 #include <stdio.h>// 第一种做法是将a定义在main函数的前面 // int a;// 完整地声明全部变量a // extern int a;// extern是可以省略的 int a;int a;int a;int a;void test();int main(int ar…

leetcode514. 自由之路(dp)

电子游戏“辐射4”中&#xff0c;任务“通向自由”要求玩家到达名为“Freedom Trail Ring”的金属表盘&#xff0c;并使用表盘拼写特定关键词才能开门。 给定一个字符串 ring&#xff0c;表示刻在外环上的编码&#xff1b;给定另一个字符串 key&#xff0c;表示需要拼写的关键…

java实现递归算法_如何在Java中实现二进制搜索算法而无需递归

java实现递归算法by javinpaul由javinpaul 流行的二进制搜索算法的迭代实现&#xff0c;用于在排序数组中查找元素。 (An Iterative implementation of the popular binary search algorithm to find an element in a sorted array.) Hello everyone! I have published a lot …

Django 入门项目案例开发(中)

关注微信公众号&#xff1a;FocusBI 查看更多文章&#xff1b;加QQ群&#xff1a;808774277 获取学习资料和一起探讨问题。 昨天已经描述了如何搭建Django的开发环境&#xff0c;今天描述业务流程&#xff0c;具体我们要实现一个什么样的业务&#xff1b; 以下的业务都是假设的…

纵横公路造价软件学习_通辽分公司组织开展2020年 养护工程造价预算培训

为进一步提高养护员工业务水平和业务素质&#xff0c;提升熟练掌握信息化公路工程造价预算&#xff0c;11月5日&#xff0d;11月8日期间,通辽分公司组织开展了2020年养护工程造价预算培训。养护科全体人员、基层所站统计人员共计16人参加培训。本次培训邀请了纵横公路工程造价管…

java 生成二维码

一步一步用 java 设计生成二维码 转至 http://blog.sina.com.cn/s/blog_5a6efa330102v1lb.html 在物联网的时代&#xff0c;二维码是个很重要的东西了&#xff0c;现在无论什么东西都要搞个二维码标志&#xff0c;唯恐落伍&#xff0c;就差人没有用二维码识别了。也许有一天生分…

leetcode 922. 按奇偶排序数组 II(双指针)

给定一个非负整数数组 A&#xff0c; A 中一半整数是奇数&#xff0c;一半整数是偶数。 对数组进行排序&#xff0c;以便当 A[i] 为奇数时&#xff0c;i 也是奇数&#xff1b;当 A[i] 为偶数时&#xff0c; i 也是偶数。 你可以返回任何满足上述条件的数组作为答案。 示例&a…

机器学习 深度学习 ai_如何突破AI炒作成为机器学习工程师

机器学习 深度学习 aiI’m sure you’ve heard of the incredible artificial intelligence applications out there — from programs that can beat the world’s best Go players to self-driving cars.我敢肯定&#xff0c;您已经听说过令人难以置信的人工智能应用程序-从可…

arcgis插值不覆盖区划图_ArcGIS绘图—空气质量站点数据插值绘制等值线图

作者&#xff1a;吴琳&#xff1b;陈天舒&#xff0c;山东大学环境科学&#xff08;大气化学&#xff09;博士在读数据&#xff08;Excel格式&#xff09;&#xff1a;多站点污染物数据&#xff08;国&#xff0c;省&#xff0c;市控点&#xff09;&#xff0c;站点经纬度信息绘…

数字校验

1 function validNumber(fieldname,fielddesc){2 var value $.trim($("#key_"fieldname).val());3 var num /^([0-9.])$/;4 5 var flag num.test(value);6 if(!flag) {7 alert("【"fielddesc"】只能输入数字");8 …

JavaScript覆盖率统计实现

主要需求 1、 支持browser & nodejs 由于javascript既能够在浏览器环境执行&#xff0c;也能够在nodejs环境执行&#xff0c;因此须要能够统计两种环境下单元測试的覆盖率情况。 2、 透明、无缝 用户写单元測试用例的时候&#xff0c;不须要为了支持覆盖率统计多写代码&…

leetcode 328. 奇偶链表(双指针)

给定一个单链表&#xff0c;把所有的奇数节点和偶数节点分别排在一起。请注意&#xff0c;这里的奇数节点和偶数节点指的是节点编号的奇偶性&#xff0c;而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1)&#xff0c;时间复杂度应为 O(nodes)…

NSLog打印当前文件,当前函数,当前行数

NSLog(”%s, %s, %d”, __FILE__, __FUNCTION__, __LINE__); 转载于:https://www.cnblogs.com/shenfei2031/archive/2011/08/06/2129636.html

单元格内容分列多行_姓名太多,放在一列打印时浪费纸张,可以分成多行多列打印...

在日常工作中&#xff0c;往往会碰到这种情况(如下图)&#xff1a;只有一列数据&#xff0c;而且比较多&#xff0c;如果打印起来就浪费纸张&#xff0c;然后复制、粘贴把表格变成几列&#xff0c;方便打印。今天小编和大家分享不用复制、粘贴&#xff0c;就能快速完成一列分成…

caesar加密_如何编写Caesar密码:基本加密简介

caesar加密by Brendan Massey由布伦丹梅西(Brendan Massey) The Caesar Cipher is a famous implementation of early day encryption. It would take a sentence and reorganize it based on a key that is enacted upon the alphabet. Take, for example, a key of 3 and th…

Java中接口、抽象类与内部类学习

2019独角兽企业重金招聘Python工程师标准>>> Java中接口、抽象类与内部类学习 接口与内部类为我们提供了一种将接口与实现分离的更加结构化的方法。 抽象类和抽象方法 抽象方法&#xff1a;仅有声明而没有方法体。 抽象类&#xff1a;包含一个或多个抽象方法的类&am…

leetcode 402. 移掉K位数字(贪心算法)

给定一个以字符串表示的非负整数 num&#xff0c;移除这个数中的 k 位数字&#xff0c;使得剩下的数字最小。 注意: num 的长度小于 10002 且 ≥ k。 num 不会包含任何前导零。 示例 1 : 输入: num “1432219”, k 3 输出: “1219” 解释: 移除掉三个数字 4, 3, 和 2 形成…