@@ -15,33 +15,33 @@ void main() async {
1515 /// Do not forget to call [Client.close] when you're done using it.
1616 final httpClient = Client ();
1717
18- /// We'll use a logging handler to how the requests and responses
18+ /// We'll use a logging handler to show the requests and responses.
1919 final httpHandler = LoggingHttpHandler (DartHttp (httpClient),
2020 onRequest: (r) => print ('${r .method } ${r .uri }' ),
2121 onResponse: (r) => print ('${r .statusCode }' ));
2222
2323 /// The JSON:API client
2424 final client = RoutingClient (JsonApiClient (httpHandler), routing);
2525
26- /// Create the first resource
26+ /// Create the first resource.
2727 await client.createResource (
2828 Resource ('writers' , '1' , attributes: {'name' : 'Martin Fowler' }));
2929
30- /// Create the second resource
30+ /// Create the second resource.
3131 await client.createResource (Resource ('books' , '2' , attributes: {
3232 'title' : 'Refactoring'
3333 }, toMany: {
3434 'authors' : [Identifier ('writers' , '1' )]
3535 }));
3636
37- /// Fetch the book, including its authors
37+ /// Fetch the book, including its authors.
3838 final response = await client.fetchResource ('books' , '2' ,
3939 parameters: Include (['authors' ]));
4040
41- /// Extract the primary resource
41+ /// Extract the primary resource.
4242 final book = response.data.unwrap ();
4343
44- /// Extract the included resource
44+ /// Extract the included resource.
4545 final author = response.data.included.first.unwrap ();
4646
4747 print ('Book: $book ' );
0 commit comments