Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would be nice if all models were json serializable #17

Open
sgehrman opened this issue Oct 22, 2023 · 3 comments
Open

Would be nice if all models were json serializable #17

sgehrman opened this issue Oct 22, 2023 · 3 comments

Comments

@sgehrman
Copy link

I want to pass from backend to frontend, and it would be easier if they would serialize to json.

@amugofjava
Copy link
Owner

Hi @sgehrman,

This is an interesting idea. Are you thinking of just being able to serialise the models to JSON, or also thinking of de-serialising JSON back into the models?

@loveoverflowdev
Copy link

Flutter doesn't support Reflection like Java. So you cannot see any framework like GSON.
Actually, Dart language supports mirror, which is similar to Reflection, but this feature was ignored by Flutter

@amugofjava
Copy link
Owner

You're right, Flutter doesn't support reflection but there are ways this request can be achieved. You can serialise/deserialise objects to/from JSON manually (my preferred approach) or via code gen using a package such as json_serializable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants