You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can also return any Dart object in the `body` of the `Response.json` constructor and it will be serialized correctly as long as it has a `toJson` method that returns a `Map<String, dynamic>`.
64
64
65
65
:::tip
66
-
Check out [json_serializable](https://pub.dev/packages/json_serializable) to automate the `toJson` generation.
66
+
Check out [`json_serializable`](https://pub.dev/packages/json_serializable) to automate the `toJson` generation.
67
+
:::
68
+
69
+
:::caution
70
+
`json_serializable` uses [`build_runner`](https://pub.dev/packages/build_runner) which expects code to be within the `lib` directory. In order for the code generation step to work, make sure the `User` model below is located somewhere within the top level `lib` directory.
0 commit comments