Posts

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, ...

Curiosity killed the Flutter

Image
Overview In this post I'd like to give you a high level overview of the Flutter framework; I try to explain what Flutter is and isn't, how it works, and instead I deliberately ignore how to start to code with it, as there's plenty of material online. Stay with me if it sounds interesting to you. What Flutter is Flutter is a cross-platform framework (developed by Google), based on the Dart programming language  (developed by Google). Flutter allows developers to deploy a mobile application on both Android and iOS; the very same application, actually. Last but not least, Flutter is the primary way to write an application for Fuchsia , a new os (developed by Google). At the time of writing, September 2019: Name Stable Initial Stars Open issues Commits Contributors Forks Flutter 1.9.1 05.2017 75269 7888 15773 446 9282 Dart 2.5.0 10.2011 4267 4895 66676 233 552 Note that Flutter can also deploy the application as web application and ...

Intro

In case you're in need of some mobile development, don't hesitate to contact me: alessio.salvadorini@fluxit.dev