Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • DART Cookbook
  • Toc
  • feedback
DART Cookbook

DART Cookbook

By : Ivo Balbaert
4 (2)
close
DART Cookbook

DART Cookbook

4 (2)
By: Ivo Balbaert

Overview of this book

If you are a Dart developer looking to sharpen your skills, and get insight and tips on how to put that knowledge into practice, then this book is for you. You should also have a basic knowledge of HTML, and how web applications with browser clients and servers work, in order to build dynamic Dart applications.
Table of Contents (13 chapters)
close
12
Index

Using Lawndart to write offline web apps

What if the main requirement is that your app can work detached, providing universal offline key-value storage, whether IndexedDB is supported by your client's browsers or not? Then, Lawndart comes to the rescue.

Lawndart (https://github.com/sethladd/lawndart, but available via pub package) is not a new database, but rather a manager, which automatically chooses the best local storage mechanism available on the client. It was developed by Seth Ladd as a Dart rework of Lawnchair (http://brian.io/lawnchair/). You can see it in action in the project using_lawndart.

How to do it...

Import the Lawndart package by adding lawndart:any to your pubspec.yaml file. The following is the relevant code from the startup script using_lawndart.dart:

void main() {
  js = new JobStore();
  // 1- creating and opening the database:
  js.open();
  querySelector("#store").onClick.listen(storeData);
}

storeData(Event e) {
  var job = _jobData();
  // 2- writing...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete