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
I was thinking about how to pass additional general parameters without changing each function. Let's say: add a cancellation token or a unique user action number. It seems to me that adding such a description form will make it possible to do this easily.
Now:
@GET("/api/items/{itemId}")
Future<ItemInfo> getItemInfo({
@Path("itemId") required final String id,
@Queries() required final Params params
});
Suggestion:
class RequestParamsItem {
const RequestParamsItem({ required this.id, required this.params });
// Params
@Path("itemId") final String id;
@Queries() final Params params;
}
@GET("/api/items/{itemId}")
Future<ItemInfo> getItemInfo(
@RequestParams() final RequestParamsItem params,
);
Then it would be possible to add a base class for common parameters.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was thinking about how to pass additional general parameters without changing each function. Let's say: add a cancellation token or a unique user action number. It seems to me that adding such a description form will make it possible to do this easily.
Now:
Suggestion:
Then it would be possible to add a base class for common parameters.
And inherit all requests from it.
Beta Was this translation helpful? Give feedback.
All reactions