Handling permission requests in Android for Flutter plugins

Updated for the new plugin registration process in Flutter 1.12. While building the Android functionality for a plugin recently I had to handle a system permission request. Although all the parts of that are simple it took me a while to figure out how to put them together. In hopes of making it simpler for others looking to do this here’s all the bits in one place. Note: Code examples are Kotlin, there’s a full gist here. The gist is for pre 1.12, I’ll try to get a post 1.12 gist up in the next little while but until then [Read on…]

DST Dart and DateTime & How to Unit Test

Like all programmers I have a pretty long held grudge against daylight savings time, leap years, time zones, and just generally anything to do with dates and times. The ways in which date complexity have hurt over the years are many and varied. This year’s pain provided a good opportunity to use the excellent unit test support for time in Dart. This post is a tiny bit about date calculations and mostly about how to get control over dates in tests. What Went Wrong This Year This is the history and context part of the post. If you just want [Read on…]

Character Encoding and Go on AWS

Ah character encoding, my old friend, I have not missed you. I was visited recently by a recurring demon from my past, character encoding. Sometimes it seems like every new environment is just waiting to spring some encoding problem on me. Since pretty much all modern environments use utf-8, these are at least getting rarer. This post describes how to ensure that responses from API Gateway endpoints from Go are properly interpreted by the receiver. Lambda Proxy Response The response from a Lambda proxy integration to API Gateway in Go is usually an APIGatewayResponse object. In my case I was [Read on…]

Defensive Programming Saves the Day – Again

Every once in a while the value of a coding practice like unit testing is reinforced, yesterday was one of those days so I wanted to share with my future self in case I ever start to doubt. Also, the set of technical practices that I first learned as XP (Extreme Programming), are not as common as I used to think, so this is my small contribution to improving that. The Problem The code was using an ID received from an external source as an internal unique identifier. The identifier was assumed to be unique across objects of the same [Read on…]