The topic of this article is controversial, but this is my real experience. It may apply in Hong Kong only; it may/may not apply in your country. It may apply to the companies I worked for only; it may/may not apply to your company. If your company works in a total different way, congratulations and please treasure it.

I have wanted to write this article for a long time. And now I have been working in this industry as a programmer for 5 years, I think I know it well enough to talk about it. In these 5 years I…


Note: This article is for falling-back asset images only. If you want to display a placeholder for failed network images, use FadeInImage.

Problem

In my job I created a flutter package (e.g. amazing_package), which contains widgets/utility functions that are widely used in different projects (e.g. temperance_project, prudence_project, courage_project, justice_project). The widgets, of course, do display some icons or images for UI, like this:

class ExampleWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Image.asset(
'assets/images/icon.png',
package: 'amazing_package',
),
);
}
}

Note the package parameter, it specifies which package contains this image asset. …


Most apps don’t work locally, they send/receive data to/from APIs through HTTP requests. It is a common practice to communicate with servers by formatting data in JSON/XML. Here are the reasons why you should parse the responses into objects of your models.

Separation of concern

The UI layer don’t need to know the structure of the JSON, nor how to traverse between the nodes of the XML. Parsing HTTP responses into objects lets the UI care their own business.

Flexibility

Apart from carrying data, we can implement some handy methods in the custom classes. For example if a JSON carries…


In programming we often define constants. If you don’t know the benefits of using constants, check this StackOverflow question. While there are different ways to define constants in Flutter, let’s talk about them.

Assume I’m writing a mobile application, it stores user preferences in local storage. Each value in the local storage must have a key (e.g. save_user_id: true, save_user_id is the key and true is the value), I’m going to define the keys in constant.

1. Plain

This works but the constant names are so long and not elegant. Also once we import this file, the namespace is…


Yesterday my app review is being rejected by Google Play, because it uses jPush. In case you don’t know what jPush is, it is a push notification service provided by a China company called JiGuang(Aurora). Along the push notification, the company provides many other services, for example analytics. It’s just like a China version of Firebase.

I received an email:

APK REQUIRES VALID PRIVACY POLICY
Your app is uploading users’ Installed Application information via Jiguang SDK without posting a privacy policy in both the designated field in the Play Developer Console and from within the Play distributed app itself.

APK…


I’m very difficult to sleep. The environment has to be total dark, the temperature should be under 21 degree celsius, and there should not be any sounds. I couldn’t drink any tea or coffee during the day. There are many other factors which I don’t know.

I have been an Apple Watch user for 3 years, and I still love my watch. I use it as the transportation card (Octopus Card in Hong Kong), I measure my performance during workouts. When they talk about Apple Watch sleep tracking, I think this is not for me since I cannot sleep with…


Hiring is undoubtedly an important and resource-consuming process for every company. What if I told you that you can spot out bad programmers within 2 weeks? You don’t have to wait for 3 months of probation to actually know a person is unqualified.

There are tons of articles out there like “How to be a bad programmer”, they aimed to let a programmer to reflect on his own practice and do the opposite way — not being a bad programmer. …


Today I am going to demonstrate how to create a two direction (vertical and horizontal) scrolling data table with flutter, this is how it looks like:


Tl;dr: Use flutter_inappwebview instead. It is rich in feature, and the switching process only takes a few minutes.

I have developed Flutter applications for a few years and some of you may have the same thought with me: the official plugins are better. Well, we were wrong. I have switched away from the official Flutter WebView plugin, and I think you should too.

3 months ago I published an article: “Flutter: How to make WebView transparent”, that worked fine but it was only a temporary fix. …


The M1 MacBook Air I ordered, with 16GBs of RAM, is delivered today. After a few hours of testing, here are some thoughts.

Hardware

Comparing with my old MacBook(MacBook Pro 2015 with Retina display), it’s thinner and much lighter. The display is much brighter; I would switch off True Tone when connected to an external monitor, since the white balance keeps changing with True Tone on. The keycaps travel a shorter distance, but they are crisp and clicky, it feels really good to type on this keyboard. The battery life is amazing, I could easily hit 20 hours usage.

But the…

Crizant Lai

A JavaScript/Node/Flutter developer who love technical stuffs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store