Starting a Flutter project made easy with flutter factory cli

innFactory GmbH
3 min readJul 13, 2020
flutter factory cli

In april 2019, we had the opportunity to create the official app for our local Ice Hockey team Starbulls Rosenheim (Available for IOS and Android)

During our pre-development research we stumbled upon Flutter. Saying flutter was different back then is quite the understatement. This was before awesome libraries like flutter_bloc and sqfentity existed and we basically started with nothing. This process of building almost everything form scratch was long and tedious.

So after using Flutter as our primary Framework for Cross-Platform App Development for over a year and continiously improving over time, we decided to invest the time and effort into creating a starter project and accompanying CLI Tool to help ramp up development speed for new projects. The open source projects flutter-factory and flutter-factory-templates were born.

Okay, nice story. What is this and why do I need it?

flutter-factory is a CLI. It’s main purpose is to create a new Flutter project and automatically configuring it for you. Basically taking all the boring stuff out of the beginning of a new project. The base for every app created is:

flutter-factory-templates which for now is one template that includes all the important bits and pieces like

  • State management via the latest and greatest version of flutter_bloc
  • A Todo example is also included to get you started with the bloc pattern
  • Full Firebase Authentication flows with views for creating an account, signing in and even support for login with Apple, Google and Facebook.
  • You don’t want to configure these providers manually? Just use flutter-factory auth and the CLI makes it easy for you
  • Firebase Messaging support for notifications — In App notifications included!
  • Firebase Remote Config as well as local config support

To sum it up flutter-factory makes your life easier and your development process faster.

I got it. It’s cool. How do I use it?

First off, just install the CLI with

$ npm i -g flutter-factory (Also make sure you have git and firebase-tools installed.)

And now all you have to do to create a fully featured app is run

$ flutter-factory create

The CLI will guide you through setting up your new App and even automatically configuring Firebase for you.

But wait. There is more!

In addition to the create command there are even more things the CLI can help you with. There is also the command

$ flutter-factory rename

which can be executed in a flutter project directory to rename the flutter package name as well as the ios bundle identifier and android package name.

As touched on in the template features there is also the

$ flutter-factory auth

command which makes it easy to configure third party auth providers.

If you want to add a Firebase project or even create and add one to your Flutter app just run

$ flutter-factory firebase

which will let you choose one of your existing Firebase projects or create a new one and then create or select your Ios and Android Firebase App to link with your Flutter project. It will automatically download and place the configuration files in their correct locations.

What’s under the hood?

The CLI is written in Typescript and built with commander.js. Whenever you select or input something it is handled by inquirer and all the color comes from chalk. For everything Firebase, it uses your local installation of firebase-tools. Everything is open source and available for you to look into or even better contribute.

We hope this utility and template help you with your existing or new Flutter projects! If it did consider giving it a star on Github.

German Version of this Post @ innFactory Blog

--

--

innFactory GmbH

Software & Cloud Engineering Experts based in Rosenheim | Germany — We blog about: Scala, TypeScript, Dart, akka, play, react, flutter, gce, aws, azure, cloud..