A quick reference for your second migration

Image for post
Image for post

If you’ve already followed the migration guides in one of these places:

Then you know what to do. This article is a quick summary for migrating your second package or project so that you don’t have to sift through all the details in the documentation again.

Switch to the beta channel

flutter channel beta
flutter upgrade

Check dependency status

dart pub outdated --mode=null-safety

Replace any dependencies in pubspec.yaml with the null safety version.

dart pub upgrade

Note: I had an old package that didn’t use pedantic. This made Dart complain about null safety issues too early. You can add it to pubspec.yaml


For people who like to dive into the details

Image for post
Image for post

Since Flutter only supports horizontal text layouts, I’ve had to do a lot of digging into the source code of its text rendering system as I create vertical text widgets for traditional Mongolian. In this article I’ll share what I’ve discovered about how text editing widgets work in Flutter.

Before diving into that, though, let’s first review how the Text widget works.

Text rendering

Usually all we see of the Text widget is something like this:

Text(
'Hello world',
style: TextStyle(fontSize: 30),
),

However, there are many layers below that.

Widgets layer

When you use a Text widget, what it actually creates is a RichText widget. …


For people new to programming

Image for post
Image for post

Recently I’ve been teaching a class about Flutter, so this article is an introduction to Dart with a few practice exercises.

Variables

A variable is a name that can hold a value. Here’s an example:

var x = 1;

The variable name is x and it equals 1. The semicolon ; means it’s the end of the statement.

The var keyword means that x is variable. You can change it.

var x = 1;
x = 5;

Now x equals 5.

Constants

If you have a variable that won’t change, you can make it a constant:

const a =…


Step-by-step instructions to create your second Riverpod project

Image for post
Image for post
Riverpod

This tutorial takes you through building a timer app using the Riverpod package for state management. If you haven’t completed my first Riverpod tutorial about building a Counter app, you should finish that one first since it lays the foundation and explains a lot of things that I won’t repeat in this tutorial. The purpose here is to help you solidify that foundation and build upon it.

Like last time, this tutorial presents an opinionated way of using Riverpod. Rather than giving you all of the many available options (and believe me, there are many), this tutorial will only tell you one way to complete this project. …


Step-by-step instructions to help set up your first Riverpod project

Image for post
Image for post
Riverpod

It’s hard to choose a state management solution for Flutter because everyone is recommending different things. Truthfully, you can probably make any of the state management options work. I’m not here to argue that Riverpod is the best, but you’re here, so you must at least be interested in Riverpod. My goal is to help you get up and running.

Riverpod and Provider are syntax heavy and that makes them difficult to learn. This tutorial takes an opinionated position. Rather than telling you about all of the possible ways you can use Riverpod, it will tell you how to use Riverpod in one way only — a way that can be repeated in a wide range of use cases. Once you’ve mastered that way of using Riverpod, you can branch out into some of the other options that might be a better match for your particular use case. …


Image for post
Image for post
unsplash

Before doing some dedicated study and practice, iterables were kind of confusing to me. If you’re like I was, then this article is for you. It turns out they’re not that difficult. I’ll explain what iterables are and how they differ from iterators. I’ll also show you a real example of how to make your own iterable.

What is an iterable?

An iterable is one kind of collection in Dart. It’s a collection that you can move through sequentially one element at a time. List and Set are two common examples of iterable collections. Queue is another one, though less common.

If you look at the source code of List, you’ll see the…


A guide to using Ukelele

Image for post
Image for post
Standard keyboard layout

In this article you’ll create a custom keyboard layout for Mac OS that you can use to enter special Unicode characters or unsupported languages.

Default keyboards

Mac OS offers a lot of language options and keyboard layouts out of the box. You can find them by going to System Preferences > Keyboard > Input Sources. Then click the + plus button to add another one.

Image for post
Image for post

However, if you speak a minority language or need some other special purpose keyboard, you may not be able to find it.

As a case in point, I’m teaching an English phonetics class this term, and while online keyboards like ipa.typeit.org work fine, I need a more convenient solution to type the International Phonetic Alphabet (IPA) directly on my computer. I also need another keyboard to write traditional Mongolian script, which isn’t included in the Mac OS supported keyboard list. …


A guide for the Android and iOS platforms

Image for post
Image for post

This article will guide you through setting up a custom splash screen with a different background color and image for dark and light modes on both iOS and Android. This can be a little tricky for Flutter developers who don’t have native development experience with those platforms, but if you follow the directions below, you’ll be up and running in no time.

If you have your own color scheme and images you can adapt this tutorial to fit your own needs, otherwise follow the steps exactly as written. …


I just want to test out some Dart code. Why does it take so long?

Image for post
Image for post

So you see a code snippet you want to try out. Or you have a Dart programming problem you want to try to solve in isolation. What is the fastest way to write that code and get it running?

In the following article I share the journey I took to answer that question.

A Whole New Flutter Project

My introduction to Dart was through Flutter, so naturally I would create a new Flutter project whenever I wanted to test out some Dart code.

This was slow, though. I was using Android Studio, which took a long time to start up. Then I would have to integrate the Dart code somehow into the Flutter UI. I usually did that by adding it to a button’s onPressed callback. …


A guide for Flutter developers

Image for post
Image for post

Note: This article assumes that your familiar with Flutter development in Android Studio and that you’ve already installed Visual Studio Code and its Flutter and Dart plugins. These things are described clearly here.

Why switch?

I’ve been developing Android apps with Android Studio since it first came out. So when Flutter arrived, it felt very natural to keep using it. As Flutter begins to support more and more platforms, though, it’s starting to feel wrong to use an IDE called Android Studio.

It’s not only that. I’ve played around with Visual Studio Code a few times, and I like how light weight it is. It starts up right away and there’s a clean interface. Android Studio by comparison is much heavier, and while it doesn’t take terribly long to start up, it’s not an insignificant amount of time. …

About

Suragch

A Flutter and Dart developer with a background in Android and iOS. Follow me on Twitter @suragch1 or become a Patron: www.patreon.com/user?u=32145209.

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