I’ve just figured out Flutter error handling for method channels communicating with native code and wanted to capture the technique. This is something that I missed despite a fair amount of reading on plugin integration, so others might have missed it as well. There’s a very good post, Flutter Platform Channels, where I got much of this information, definitely worth a read. There are some details that it doesn’t cover, particularly about testing, and it’s not just focused on error handling, so I thought I’d boost the signal on that. Error structure An error communicated across a method channel is [Read on…]
Month: September 2019
String internationalization in Flutter
I was recently reviewing the options for app internationalization in Flutter and there was quite a lot of discussion and content written about it. In this post I’ll describe what I think the right choice is and why, as well as provide a few missing how to guides. The short version of the post is that I think you should use the built-in Flutter tools and avoid some of the suggested alternatives. Alternatives Flutter tools Flutter has a set of tools for handling Internationalization, the intl and intl_translation packages. I think the Flutter team has done a very good job [Read on…]
Flutter plugin iOS tests in Swift
Creating plugins for Flutter is well documented and pretty easy. Unit testing the resulting native code in iOS wasn’t quite as straightforward so I thought I’d capture what I did while I still remember the steps. This post shows how to create a new plugin for Flutter with a Swift implementation for iOS, and then add Swift XCTest unit tests for that implementation. Creating a new plugin To create my first plugin I followed the Flutter docs, in particular the section on Developing plugin packages. I used the version of the create command that specified the native languages, like so: [Read on…]