In “[Part 1] Code generation in Dart: the basics”, we covered what’s the motivation behind code generation, and listed the most important tools that we have available in Dart to let a computer do the hard work for us. In this article, we are going to cover how to create and use Dart annotations, and how to use source_gen and build_runner to start processing those annotations.

Annotations in Dart

An annotation is a form of representing syntactic metadata that can be added to our Dart code; in other words, a way of adding extra information to any component in our code, such as…


One of the things that I like the most about Flutter is the ease of testing that comes with the platform; testing is a first class citizen of the framework. Out of the box, you get unit tests, widget tests and integration tests. These tools are a great compliment to produce a super high quality app, but I felt something was missing…

Let me introduce you to Ozzie, our new testing friend

Ozzie is an open source package for Flutter that will assist you while running integration tests. …


Have you ever wonder what makes a software programmer a great software programmer? Think about it for a minute. The answers could be pretty much endless, and depending on who you ask, you will get different responses… but if you ask me, being a lazy programmer will be my answer ;)

Doing more with less is key to progress. No one likes repeating the same task over and over again. It is tedious, boring, and not creative at all. Humans are really bad at this. We often make mistakes when doing something repetitive. However, guess who is really good and…


State management in Flutter is a hot topic. The options available are numerous, and while that might be awesome, it is easy to feel overwhelmed, easily confused and lost when trying to pick the best solution that fits your needs. I have been there too. However, I have found a solution that fits my needs, so let me share it with you.


In my previous article, that you can find here, we build a tiny application whose only purpose was to switch the theme by pressing two different buttons. However, the code was far from perfect, since we were injecting the same instance of our themeBloc to many widgets where the themeBloc had no business, just to be able to make our app work, breaking many good software design principles.


There are many cases where you might want to support multiple themes in your application, and let the user change them dynamically. Let me explain you how to do it in this tutorial using the “business logic component” pattern, also known as BLoC.

TL;DR; For those just interested in the code, here’s the code covered in this article: https://github.com/jorgecoca/theme_switcher/tree/theme-switcher-tutorial-1

We are going to build a Flutter application that consists of:

  • A MaterialApp at the root of our app
  • Two pages: the HomePage and theThemeSelectorPage
  • A BLoC component that will receive a selected theme, and will emit a ThemeData object


Last Friday finished the first edition of KotlinConf, and it was a total success. We’re talking about a language that, within a year probably, went from being an underdog, to be considered now “the language”. Everyone seems to love it, from old school Java developers to even our Swift/iOS colleagues. Kotlin is here to stay, and JetBrains has really ambitious plans for it.

Kotlin-Native and multiplatform projects

When Google announced Kotlin as a first language for Android, the community celebrated with enthusiasm the announcement. What we did not know back then, is that JetBrains does not want Kotlin just to be the modern replacement…

Jorge Coca

Android engineer at @bmwna. Born in Madrid, living in Chicago. I have watched La La Land more times than you… and I love singing and dancing in public xD

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