andi17 andi17 - 1 month ago 17
Dart Question

How to build an offline supporting web application with AngularDart

We have been starting out on building a simple web application on AngularDart 2.

What is the best way to have it runnable on the clients even though they lost internet connection? Right now I am using Lawndart library to use the local storage for saving some data received from REST-Api and it's working fine. But I haven't figured out how to tell the client browsers to cache all sources and use them when having no internet connection. (Right now I am simply using my Redstone-Dart Server (on which the REST-Services are running) for providing the sources)

I've stumbled upon the Angular Mobile Toolkit (, but it is only for TypeScript, or is there a way to use it with Dart?

Also later in the project it might be necessary to send push notifications to the this possible with Dart and Angular 2?


Regarding the following point:

cache all sources and use them when having no internet connection

Although deprecated and having a bad reputation, I still personally use AppCache ( I understand the solution looks so 2005 when people talk about progressive apps and service worker. It is the only cross-browser solution that works now.

It is easy to setup (just serve a manifest.appcache). For angular application, it mostly contains index.html, main.dart.js and external dependencies. For me it works on Safari, Chrome and Firefox (cannot tell for IE/Edge). As iOS was a need for me, I could not find another alternative (service worker). Chrome is starting to send a warning for non https sites but so far so good.

Real push notifications are more complex in a web environment; I personally use Firebase realtime database to "push" updates