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
Occasionally, the authToken used in API calls may be invalidated. If this happens, I need to reauthenticate the user.
To do this, I need the user's credentials. Ideally, I'd like to store these credentials in the User object when it's created so I can use them later. As the credentials are not included in the API response, I'd love to do something like this:
As you can see, the use of a JsonKey argument like 'extra' would allow the additional values to be passed to the generated deserialisation function, which in turn would pass them through to the constructor unmodified.
Upon serialisation, the extra fields can be ignored, as they're application-specific and not part of the API spec.
I have a
User
object, which is deserialized from JSON in an API response:Occasionally, the
authToken
used in API calls may be invalidated. If this happens, I need to reauthenticate the user.To do this, I need the user's credentials. Ideally, I'd like to store these credentials in the
User
object when it's created so I can use them later. As the credentials are not included in the API response, I'd love to do something like this:As you can see, the use of a
JsonKey
argument like 'extra' would allow the additional values to be passed to the generated deserialisation function, which in turn would pass them through to the constructor unmodified.Upon serialisation, the extra fields can be ignored, as they're application-specific and not part of the API spec.
My SDK version, as requested
The text was updated successfully, but these errors were encountered: