Never miss a beat

Join my newsletter.

Tag: dart

Building a CI/CD Pipeline for Dart Packages with Github Actions

Published: 10/5/2020

If you look back at any of my blog posts, you’ll likely find an introduction like “Recently I was exploring…” This time is no different. I’ve been exploring Dart (and have dreams of a frontend framework written in Dart) as well as Github Actions . At work, we recently migrated TeamSnap UI (our open source component library) from our internal CI pipeline to use Github actions and it’s worked out really well. I’ve been writing Essence (a Dart virtual DOM implementation) and decided that…

Working with JSON in Dart

Published: 9/27/2020

JSON is, as of 2020, the communication standard for most web applications (comon gRPC ! You can do it!). Naturally, if you’re building a Dart application, you’ll likely want to work with JSON. Dart’s built-in dart:convert package is just the tool that you need! Creating a Model One of the first things that you’ll probably want to do is to create a model for your JSON data. In this example, we’ll use a simplified version of the Github API’s repository request . If you’d like to inspect the…

Dart's Futures and Streams

Published: 9/26/2020

Asynchronous programming in Dart is an absolute blast. Dart offers a couple of different options when writing asynchronous code: namely Futures and Streams . You can use both Futures and Streams to solve a lot of the same problems, but each serve their own purpose as well. Futures are a type that models a computation who’s value may or may not be available. If you’re unfamiliar with Futures, you can think of getting a receipt at your favorite fast food restaurant as a Future. At some point…

The Many Constructors of Dart

Published: 9/9/2020

Last night, as I was writing code in a Flutter app, I came across an interesting dilemma. I wanted to throw a custom exception if I was unable to sign in with Apple on the login screen — nothing too crazy. Naturally, this lead me to creating a custom exception. I tried something along the lines of: However, I found out quickly that this wasn’t valid. In fact, you get an error that looks like this: The generative constructor 'Exception Exception([dynamic message])' expected, but factory found…

Flutter routing inside of the Scaffold

Published: 8/11/2020

If you’re coming from React Native to Flutter, one of the first things you’ll likely ask is “How do I do routing?” First, I’d ask you to consider if you actually need routing. Instead, could you just have a global state that determines which screen to show? In most cases, probably. But if you want things to feel right when building Flutter for Web (or want decent deep linking support), you’ll probably want to build your flutter app with routing. Routing can easily be accomplished via the…