Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Learning Dart
  • Toc
  • feedback
Learning Dart

Learning Dart

4.4 (10)
close
Learning Dart

Learning Dart

4.4 (10)

Overview of this book

Mastering Dart by Projects is a step-by-step guide that aims to give you hands-on knowledge about programming in Dart using an example-based approach.If you want to become a web developer, or perhaps you already are a web developer but you want to add Dart to your tool belt, then this book is for you. This book assumes that you have at least some knowledge of HTML and how web applications work. Some previous programming experience, preferably in a modern language like C#, Java, Python, Ruby, or JavaScript, will also give you a head start. You can also work with Dart on your preferred platform, be it Linux, Mac OS X, or Windows.
Table of Contents (14 chapters)
close
13
Index

Using the mongo_dart driver to store the todo data in MongoDB


MongoDB drivers exist for a whole range of programming languages, including Dart. We will use mongo_dart in our app, which is a server-side driver implemented purely in Dart. Simply add mongo_dart: any to your app's pubspec.yaml, and issue pub install. In the code, write:

import 'package:mongo_dart/mongo_dart.dart';

todo_mongodb is a version of todo_server_dartling_mysql, but now use MongoDB as a persistent data source (clone the project from https://github.com/dzenanr/todo_mongodb). It contains a client app todo_client_idb, identical to the one in the previous section, which stores data in IndexedDB. The server part todo_server_dartling_mongodb can be started by running bin/server.dart; you should see in the editor or the console:

Server at http://127.0.0.1:8080;

If you see the following exception, it means that the mongod server has not yet been started:

SocketException: Connection failed (OS Error: No connection could be made because...
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