Creating a simple URL shortener using Flutter and Firebase

Simple and easy to use URL shortener using Firebase and Flutter. It creates a shortest URL with your own custom domain if needed, here we are going to host the web app in Firebase hosting service.

We are going to use the following Google Technologies:

  • Firebase Hosting
  • Flutter

How it works?

Link to GitHub repo here.

Here is how the app looks at different stages:

Web app at different stages

Let’s start with the Firebase Hosting. Create a Firebase project. Then enable Firestore Database.

Here I’m going to use the database in this pattern.

I’ve create a collection named links , then a random document name.

Hence the second step is creating a flutter project. Then configure the project for Cloud Firestore.

Import needed dependencies:

Dependencies: Cloud Firestore from flutter packages(

sdk: flutter
sdk: flutter
firebase_core: ^1.12.0
cloud_firestore: ^3.1.8

We are going to use Deep linking for this app to work with the shorten link (eg:

This is how the route is configured using onGenerateRoute:

Then create a lib>screen>link_screen.dart for making the redirection happen which is the main feature of this app.

That’s all for creating an link shrinker app with Flutter and Firebase Cloud Firestore.

Here’s a GitHub repo with the working code for your reference.

Happy fluttering!



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