Posts

Minimal #1 - the UI state

Image
 Overview I assume you're aware of Minimal , and you want to use it to implement a scalable and maintainable architecture. I also assume you (may) have watched my presentation about Flutter Architecture Components . In this post I'd like to show you the first step, where you want to define the UI state. It could be done also the other way around, starting from the data layer and then implementing everything until you reach the UI and its state, but empirically I found out that starting from a well defined UI state will help you to reason better about your code. The code of the Pokemon app can be found here . State, in brief With Minimal you have 3 players: a state a notifier which holds your state a manager which allows you to access your notifier A state can be anything, from a single primitive to a very complex class. When the state contains the information needed for a UI to build, it's called a UI state. There are 2 types of UI states: ephemeral state app state You can ...

Minimal #0 - Getting started

Image
 Overview In this post I'll show you how to quickly get started with Minimal , a minimalistic state management package in the context of an MVN (Model View Notifier) architecture. This is only a very brief intro to get you started. I'll expand each step in details in follow-up posts State Management in 4 Steps Adam was on spot when he wrote : I never really checked the documentation because it’s so simple and easy to use. You don’t need to read everything to start building your app. Just create an immutable class, a state holder, a manager, and use the class in your UI. It’s truly minimal in every sense! and if you've already some basic experience with other state management solutions, you'll pick this up real fast. In case you don't, or in case you're confused, there are only 4 basic steps you need to follow to start structuring your architecture. I'll summarise them here, but they're also in the README, and the package comes with an example app which s...

Minimal

Image
I just published Minimal , a minimal state management package for Flutter Architecture Components, based on the MVN (Model-View-Notifier) pattern. MVN neologism by Roman Jaquez. Thanks to NXT:FWD, as I could use one entire #myDay to try this out

Dr. Riverpod: How I learned to stop worrying and love state management

 I published the article "Dr. Riverpod: How I learned to stop worrying and love state management" on Codemagic's blog, you can read it  here .

The Unbearable Lightness of BuildContext

Image
Overview In this post I'd like to write about Flutter's BuildContext, as a mechanism to enable communication throughout the whole widget tree. The idea came to me while trying to explain a fix to a friend, and soon I realized how there was so much more behind it than the fix. I believe that contexts are very important when it comes to mobile development, as they are one of the building blocks of it. So this post shows a real life error and how to solve it, but its main focus is on the idea underlying the fix, the BuildContext. The problem Say you've added the navigation drawer to your app, following the recommended tutorial . @override Widget build(BuildContext context) { return Scaffold( drawer: Drawer( child: ListView( padding: EdgeInsets.zero, children: [ DrawerHeader( child: Text('Drawer Header'), decoration: BoxDecoration( color: Colors.blue, ), ...

Test your database

Overview In this post I'd like to show you how to test your database. I try to be abstract and general enough, though I want this post to be a basic example for a real life case you can build upon. I assume you're familiar with the official Flutter  SQLite cookbook . Stay with me if you haven't tested your database yet. Setup First of all, you'll need two dependencies: sqflite: ^1.3.0 path: ^1.7.0 and one test file in path/to/app/test/db/db_test.dart and one class file in path/to/app/lib/db/db.dart. Path is the dependency of my choice, but there are alternatives to it; sqflite is the most common choice for a SQLite database for Flutter, and there are alternatives to it too, the most interesting one being  Moor . The database class In db.dart you can define your wrapper around the SQLite database, namely DBManager. I chose to implement it as a singleton, because you want to access the database manager from anywhere in your code: class DBManager {   st...

Pixelbook as a developer machine

Image
Overview In this post I'd like to give you some of my personal thoughts and feelings about using a Pixelbook as my main developer machine, for Android and Flutter development. Before, I couldn't find online much information about it, except for two posts written by  Jasper Morgan  from Snapp Mobile, and  Tim Sneath  from Google; but still they didn't answer all my questions and curiosities, which I try to address here. Stay with me if you too would like to know pros and cons of the Pixelbook as a developer machine. Specs Dimensions: 290.4 x 220.8 x 10.3 mm aluminum unibody Weight: 1.11 kg (2.45 lbs) Display: 12.3” 2400x1600 (235 ppi) Processor: 7th Gen Intel® i7-7Y75 Memory (RAM): 16GB Storage: 512GB NVMe solid state For full specs and the other models can be checked  here . Look and feel Pixelbook From the specs you can see immediately how thin and lightweight the machine is, and at the same time how powerful it is. It's solid and robust, ...