Adding SQLite.db File From The Assets/internet (in Flutter).

Adding SQLite.db File From The Assets/internet (in Flutter).

Storing Data Locally on the mobile application is very important if you want your application to run offline. There are multiple ways to do

photo of memory cards as representation of data.

Photo by  Markus Winkler on  Unsplash

Thanks to this awesome flutter community, for loving my first and simple article on the status bar and navigation bar color customization, which inspired me to write this next article. You can read that article  here.

Storing Data Locally on the mobile application is very important if you want your application to run offline. There are multiple ways to do that. Today we will be talking about how to use the existing SQLite database in the Flutter application.

First, we will be looking for a way to import the database from the assets. And secondly, we will be looking for a way to import the database from the network file. This is handy if our database is large and we don't want our app size to be scary big.

Let’s Begin:

The very 1st step would be to add the necessary packages.

1. The sqflite package. (The newer flutter version supports SQLite in flutter framework, I don't know from which version, I am lazy to do that research. 😜 ).

2. The path_provider. (to get the path of the application directories). or you can use the getDatabasesPath() from the SQLite package(which I didn’t know was possible when I was writing this article so I haven’t tested this. )

  1. Adding SQLite Database from the assets.

To add your database.db file, create a folder with name assets in the root project directory, and under assets create another directory called db and add the database files here.

Image for post

android flutter

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Google's Flutter 1.20 stable announced with new features - Navoki

Google has announced new flutter 1.20 stable with many improvements, and features, enabling flutter for Desktop and Web

Top Android Projects with Source Code

Android projects with source code - Work on real-time android projects. We’ll start project ideas from beginners level and later move to advance projects.

What is Flutter and why you should learn it?

Flutter is an open-source UI toolkit for mobile developers, so they can use it to build native-looking Android and iOS applications from the same code base for both platforms. Flutter is also working to make Flutter apps for Web, PWA (progressive Web-App) and Desktop platform (Windows,macOS,Linux).

Adobe XD plugin for Flutter with CodePen Tutorial

Recently Adobe XD releases a new version of the plugin that you can use to export designs directly into flutter widgets or screens.

Building Dark Mode Theme in Android

Hello World, today we are going to see how we can implement a dark theme or night mode in our android application. This tutorial is going to be very simple and easy to understand. The dark theme is attractive to users and it is comfortable for low light conditions.