A persistent database is a really important factor in app development. Saving some data on the device, retrieving it when required, and working with it especially with limited network capabilities, privacy reasons make it more compelling.
SQL databases are one of the most used databases supported across a variety of platforms. When developing Flutter apps, you can use sqflite package for the same. It is easy to use, stable, and supports direct SQL commands as well as Maps as input while performing the requested operation.
In this article, I will show you how to instantiate the database and perform basic operations which include inserting, updating, querying, and deleting data. …
If you have just started working in Dart, you must have come across Future objects, or if not, you will. A lot of built-in dart methods & functions return or work with Future object. So, you might ask, what is this Future? Why does this X method returns a Future object? The answer to these questions is quite simple if you focus on the naming of the object itself.
A Future is something that will happen, it has not happened now, but it will happen and that’s inevitable. That’s what a Future object in dart implies. …
While programming, you might run into some sort of situation, where you need to work on a file stored at a specific location, maybe write something on it, read it or anything else. Dart supports working with files as well.
In order to start working, first of all we need to import dart’s inbuilt io (input output) library.
Taking a user’s input can be sometimes a crucial thing while writing scripts to automate a job. Just like all other programming languages, dart also supports taking user’s input. Here’s how you can do that:
First of all import dart’s io (input output) library.
Once imported, this library allows us to access a lot of useful classes and methods. For taking a user’s input from CLI, we need to create an instance of stdin class and use readLineSync method on it.
var line = stdin.readLineSync();
This will store the input from the user into the line variable. However, one must note that the taken inputs are always are of type String. Hence, in case you need the input in a certain type, you need to manually convert it. …