Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Dart
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning Dart

Learning Dart

4.4 (10)
close
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
close
13
Index

Using JSON web services


In this section, we code a web server that communicates with our clients and runs the todo app; the todo data is sent to and from the web server in the JSON string format. Spiral s06 consists of a server and a client part. To run it, first start the server (lib/server/server.dart) in Dart Editor or from the console; it runs when you see in the server.dart tab in Dart Editor: Listening for GET and POST on http://127.0.0.1:8080.

(If it does not run, navigate to Run | Manage Launches.) Then start one or more clients (web/app.html) in Dartium. Locally, the client still saves the data in IndexedDB. Our screen has two new buttons:

  • To server: The client converts the the data to the JSON format and sends it to the server, where the data is stored in the main memory (post data to server)

  • From server: An another client (on a different machine) can request the server data to update its local database (get data from server)

Server communication in Spiral s06

The following is the...

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

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY