I was following the tutorial here to familiarize myself with Aqueduct and Dart. The code from part 1 was working fine but once I converted from an in-memory list of heroes to using the database, it stopped working. I confirmed there was data in the database (Postgres) and the back-end was successfully connecting and reading from the DB. However, there was an error that the ManagedObject couldn't be serialized. Nothing in this tutorial does it mention any details about serialization. I attempted to try adding @JsonSerializable to my model class but still had the same problem. It seems like it is not the model object itself but the fact that the API is returning a: Future<List<Hero>>
? Error is:
Converting object to an encodable object failed: Instance of 'Future<List<Hero>>' #0 _JsonStringifier.writeObject (dart:convert/json.dart:649:7)
The tutorial seems to suggest that classes that extend ManagedObject are serializable by default/automagically. Is that assumption incorrect? It seems strange there would be a tutorial on the Aqueduct website that is broken right out of the box.