Organizing my articles for Flutter and Server Side Dart

All of my Medium articles below are friend links, so anyone can read them without a Medium subscription. If you are ever blocked from reading one of my articles, just come here to get the friend link. However, if you’re thinking about becoming a Medium member anyway and you sign up from my referral page, part of your monthly subscription fee goes to me.

New articles


Understanding the difference between deep and shallow copying

Photo by Kelly Sikkema

When you create a collection in Dart, the contents of the collection are mutable. You can see that in the following example:

final myList = ['sheep', 'cow'];
myList.add('horse'); // [sheep, cow, horse]
myList.remove('cow'); // [sheep, horse]
myList[0] = 'goat'; // [goat, horse]

That is all very useful when you want to manipulate the elements of a collection. However, sometimes you want to share a copy of your collection with someone else.

Let’s look at what happens when you “copy” a list by assigning it to a new variable:

final myList = ['sheep'…


The five-step process and how it relates to software engineering

Elon Musk describing his five engineering principles (screenshot from Everyday Astronaut interview)

I recently listened to Elon Musk’s interview from Tim Dodd of the Everyday Astronaut as Elon gave him a guided tour of the SpaceX Starbase site. It was a YouTube video, but I say listened and not watched because I was riding my bike with my phone in my pocket.

In response to a question about a design change to part of the rocket, Elon began describing a five-step process that he tries to have everyone at SpaceX implement rigorously. As I continued pedaling my bike down the streets and…


A guide to using the mailer package

Photo by Brett Jordan

When an important event happens on your Dart server, it would be nice to get a notification. One way to do that is to send yourself an email. This article will cover how to do that using the mailer package.

You’ll create a simple Dart server where every time someone makes a POST request to the /contact endpoint, Mailer will send you an email containing the body of the POST.

You can find the full code at the bottom of the article.

What is SMTP?

The way Mailer works is by helping you connect to an…


Comparing plain old Dart, JSON, YAML, and environment variables

Photo by Adi Goldstein

By now you’re used to setting configuration options in pubspec.yaml, but what if you want to define your own config values and read them inside your app? How do you do that? I’ll give you an overview of some options in this article.

Plain old Dart

One easy solution is to just use a plain old Dart class. Create a file named my_config.dart and add the following code:

class MyConfig {
static const String country = 'Mongolia';
static const String animal = 'horse';
}

Then you can use it anywhere in your code by…


A full step-by-step tutorial

If you’re only playing short audio clips in your app, then generally a simple audio player plugin will work. However, for longer audio forms like music or podcasts, this is often insufficient. Let’s say you start playing a podcast but then leave this app to check your fitness app. What does the podcast app do? It could stop the audio as soon as you leave, but you want to keep listening, so that’s not a good option. On the other hand, if the app allows the podcast to keep playing in the background, imagine the second…


Navigating null safety with no implicit casts or implicit dynamic types

Switching to Dart 2.12 with sound null safety was overall pretty painless…except for one thing: All my JSON to object conversions broke, and it was super difficult to figure out how to make the errors go away.

In this article I’ll explain some of the background behind that and how to safely unpack JSON objects. Through writing this article I actually changed my thinking about some things, so I’ll let you see my thought process without rewriting everything as if I understood it all from the beginning.

Strong mode in analysis options

I switched…


Skilled work

Programming is difficult. Although it’s not so hard to get the Counter app running, becoming an expert at a framework like Flutter and a language like Dart takes time, probably years. So in this article, I’ll give some advice to help you get to the next level.

There are a few categories we’ll look at:

  • State management
  • App architecture
  • Testing
  • UI design
  • Dart on the backend
  • Flutter and Dart internals
  • Advanced topics

Note: This article is mainly geared toward intermediate-level Flutter developers. If you’re a beginner, stop reading Medium articles and get out there and start making something. …


There’s so much more than flutter pub get

Modified screenshot from pub.dev

If you’ve been working with Flutter for any length of time, you’ve probably run flutter pub get in the terminal or at least seen a popup about it from your IDE. The Pub tool has a lot more than just get to offer you, though. Pub is the official repository for the Flutter and Dart packages available at pub.dev, and pub is your commandcommande line interface to that repository. This article will introduce the many optionsoptio that are available with the Pub tool.

Overview

Assuming you have a recentune récent version of Flutter…


Loading, looping, seeking, shuffling, and editing

This tutorial will teach you how to play and navigate multiple songs using the Just Audio plugin for Flutter. You’ll learn about loading audio sources, seeking to another song, repeating a song or playlist, randomizing the song order, and editing the contents of the playlist. If you’re new to Just Audio, you should go through the previous tutorials first since this one will assume you’re already familiar with the basics:

  1. Playing short audio clips in Flutter with Just Audio
  2. Streaming audio in Flutter with Just Audio

Setup

Rather than walking you through the entire UI…

Suragch

Flutter and Dart developer. Twitter: @suragch1

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