Flutter 的 setState 执行流与 updateChild 六条路径
点击与调度 · 一帧的执行顺序 · 局部更新 · build 期间调用 以 Wonderous 使用的 Flutter 3.47.2(源码提交 d3b14c8769)为准。先看一个已经显示在屏幕上的页面:用户点击按钮,事件回调执行 setState(() { _selected = true; })。回调返回时,_selected 已经变了;屏幕何时反映这个值,取决于框架何时重建该 Element,以及新配置改变了哪些渲染属性。 本文沿用《Flutter 实战》14.3 的阶段顺序,图中方法名和队列归属对应这个 SDK 版本。原文章节 · State.setState 官方说明
Read moreSort Algorithm(1): Elementary Sort Javascript Implement - Selection, Insertion, Bubble Sort
Elementary Sort, The slowest and simplest Sort algorithm, time complexity is O(n^2) Bubble SortAs Its name, the bigger element will be like a heavy item, Sinking to the bottom of the water, and the small one will swim up to the surface Here’s the algorithm animation: Bubble Sort javascript code: 1234567891011121314151617function bubbleSort(a) { for (..
Read moreImplement Your Own Call, Bind, Apply
these three functions are very useful in everyday development, What exactly did they do? Let's break it down.123## calluse case: var person = { name: “leo”, sayName(greetings) { console.log(greetings, this.name); },}; var anotherPerson = { name: “norris”,}; person.sayName.call(anotherPerson, “hi”); 12345678What ```function.call(object,...p..
Read more

Understand Javascript Prototype chain - Prototypal Inheritance
preludeEver since I was introduced to the programming language javascript, Its prototype chain has always bothered me,I read a lot of blog, posts about this topic, most of them say the same thing, Put a picture like this in the article, and told readers to remember : 121. People.prototype.constructor == Person 2. PeopleLeo.__proto__ == Person.prototype ..
Read moreWhat Did new Keyword, Object.create() Do In Javascript
We can use both new and Object.create() implement inherantance in javascript: 12345678910111213141516171819202122// newfunction People(name) { this.name = name;}People.prototype.sayName = function () { console.log(this.name);};var leo = new People("leo");// object.create()var People = { name: "liu", sayName(..
Read moreYou Must Know About Object - How To Loop Through An Object In JavaScript
Loop through an Object is much harder than doing the same thing in an Array because you can’t use those convenient syntaxes like for-of, forEach (by the way, you should never use for-in) when dealing with an Object, so today let’s look at how many methods are there to loop through an Object Create an object to test12345678910111213141516171819202122functio..
Read more

RPC, REST, GraphQL - What Are These API Achitectures
I believe many newbie to web Developer have these questions, so let’s talk about it and fiugre out the exact details of these API Achitectures(or specifics) RPC (Remote Procedure Call) In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on an..
Read moreVar, Let - What's Difference In The For Loop
We’ve all written simple for loops to iterate over arrays and objects countless times. But have you ever stopped to consider how the scope of variables used inside loops works? I recently came across an interesting code snippet that highlighted an important distinction between var and let in this context. 1234for (var i = 0; i < 3; i++) { const lo..
Read moreHistory of javascript module development
Recently I came across an article call The Evolution of JavaScript Modularity from a github Repo, This article is so well-written, thus this is kind of a summary of that article. The Name CollisionFrom the moment of its appearance JavaScript has used the global object window as a storage for all variables defined without the var keyword. In 1995-1999 it ..
Read moreThe Var, let, Const - What's the Difference?
Aspect var let const Scope Function scope; variable is accessible inside function even if declared after usage Block scope; variable is only accessible inside nearest enclosing {…} Block scope; variable is only accessible inside nearest enclosing {…} Re-declared Can re-declare var anywhere in the function Cannot re-declare let in the same block Can..
Read more