Responsive design is always a nightmare for many frontend developers, particularly when developing applications without careful planning and design consideration. Poor responsive design choices can exponentially increase the complexity of debugging and testing processes.

Flutter was developed to handle cross-platform solution in the first day. It effectively addresses the challenges of building applications for multiple platforms whilst maintaining a single codebase. If you are developing mobile app in a startup company or you are implementing some performance sensitive requirement, Flutter can provide much better experience than React Native. It is a very good idea to render the UI with its own way to tackle with the fragmentation problem of Android devices. I can continually bragging Flutter for saving my life in development, until I was asked to develop a Flutter Web application.

In this article, I will describe some of my understanding on responsive design with MediaQuery in Flutter, focusing on practical approaches and common pitfalls to avoid.

FlutterPerformanceDart

When I was young, I was thrilled to discover I could cancel HTTP requests using cancelToken. However, it took me a month to realize that this didn't actually help reduce server load. These days, developers are quite enthusiastic about AbortController and AbortSignal. Some influential developers discovered that AbortController could be used not just for cancelling fetch requests, but for nearly any event. Soon after, social media became filled with articles about AbortController - to the point where not writing about it seemed to suggest you weren't a proper frontend developer.

I agreed that these features are great and fun, but as a developer, we should not only know what is it, but also know how it works.

Let's start from the basic use case: cancel a fetch request.

AbortControllerHTTP

An article about the inline style is faster than importing stylesheet and inline class was posted a couple of weeks ago. Many front-end developers were surprised about this and suggested that maybe we can compile styling methods like tailwind CSS into inline style in the future. I was also surprised that frameworks are so popular that people forgot the history of styling websites and how the browser renders the website.

PerformanceHistoryTailwind CSSStyleXCSSBrowser Rendering

Recently, I was tasked with implementing a new toast that remains fixed at the top of the screen using Flutter's Snack Bar. Initially, I assumed it would be a straightforward process – a matter of calling showSnackBar and configuring the behavior to floating as floating, adjusting the margin to ensure it floats at the screen's top.

FlutterDartSnackBarAndroidOverlayiOS

As we all know, JavaScript is a beautiful, elegant, and well-designed language. Brendan Eich spent much of his life designing it. Thanks to that, we have such an intuitive language:

NaN !== NaN // true
0.1 + 0.2 // 0.30000000000000004
1 < 2 < 3 // true
3 > 2 > 1 // false 
[] + [] // ""
{} + {} // "[object Object][object Object]"
[] + {} // "[object Object]"
{} + [] // 0

We had a knowledge-sharing slack-off session today, and someone shared a question about the beauty of the language's syntax. It reminded me of my previous job in China. Almost all Chinese companies like using these elegant syntax and principles as interview questions. When I think about the most memorable question I prepared, it has to be this one:

What is the result of Math.max() < Math.min()? why?

JavaScriptMath

Well. it's been a while since I started to use Flutter to develop a commercial App. There are some good practices that help me to deliver high-quality code, reduce the times to refactoring for the performance and prevent OT.

FlutterDartAndroidiOS

When I first time get in touch with Flutter, it was still a baby project in early 2018. Nowadays, it became even more popular than React Native -- My ex-open-source-area in the past. My current company decides to develop an App with Flutter and as the weakest Penguin in the company, I was forced to join this project.

Flutter became stabler and more functional, but it still has some bugs they have never fixed, and some problems they should handle many years ago, one problem is that they should shake the unused images during the building. It is a big problem that there is no simple way to delete it to reduce the built bundle size. It is hard to find a library/script to delete them, so why not just write it by myself?

TLDR: https://pub.dev/packages/delete_unused_image

With the size growing of the project, an increasing number of logs are written. It is tough to find out helpful detail within hundreds of irrelative logs. Although JavaScript is awkward in many places, it has very powerful tools and ecosystems to debug when it is running on the browser.

JavaScriptPerformanceDevTools

Due to the high amount of wordle spam from my friend, I need some tools to reduce their interest of play Wordle. During these months, I developed a website to provide hints of possible worlds and continue to finetune the algorithm. Then, the limitation of the website is found, so I turn to build a browser extension.

JavaScriptChrome ExtensionMutationObserverShadow DOMWordle

In a previous interview, a debug question causes me to deep consideration. What is the GC strategy of JavaScript when we are using setTimeout and setInterval? What happen if we did not clear the timer before releasing the timer of setTimeout?

JavaScriptGCsetIntervalMemorysetTimeout

Lazy loading is a useful technique that can delay loading non-essential content in an application until it is needed. It can reduce the bundle size and increase the loading performance. However, there are many implications and solutions of that in history.

JavaScriptIntersection Observer APILazy Load

When we are completing the question on leetcode or developing a complicated project, iteration is a useful syntax to traverse complex data structures.

The Array is a common data structure in computer science, the majority of languages provide while and for-loop to iterate the array. Moreover, High-level programming languages always provide some APIs to manipulate arrays.

JavaScript offers tons of methods to control, but querying methods were not provided until ES5. The APIs from ES5 decrease the codes and rapidly increase the readability.

JavaScriptPerformanceArray API