© Fu Cheng 2019
F. ChengFlutter Recipeshttps://doi.org/10.1007/978-1-4842-4982-6_9

9. Service Interaction

Fu Cheng1 
(1)
Sandringham, Auckland, New Zealand
 

Many non-trivial mobile apps require interaction with backend services. This chapter covers essential concepts related to service interactions in Flutter.

9.1 Working with Futures

Problem

You want to work with Future objects .

Solution

Use then() and catchError() methods to handle results of Future objects.

Discussion

When using code from Flutter and Dart libraries, you may encounter functions that return Future objects. Future<T> class from dart:async library is a representation of delayed computations. A Future object represents a potential value or error that will be available in the future. When ...

Get Flutter Recipes: Mobile Development Solutions for iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.