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

add postParam helper method to request class #47

Closed
wants to merge 5 commits into from

Conversation

gilbertbw
Copy link

No description provided.

@gilbertbw
Copy link
Author

Provides a more user friendly solution to #32

var param = new Completer();

List<List<int>> buffer = [];
_request.listen((data){buffer.add(data);}, onDone: (){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will add a new listener on each postParam call, the more postParam calls you make, the more performance you loose. I think we can do this once in the constructor and expand the params map with POST params, so user will be able to access them like the GET ones.

@gilbertbw
Copy link
Author

I have made the suggested change but this commit is not working as whilst waiting for the request.listen to return data and calls to request.param() fail to return POST data.

Created getParams, urlParams and postParams maps. params map now contains values as they would have been prioritised by the param() method: url then get with the addition of post params in third place.

param() now allows the method to be specifed, this can be 'url', 'get' or 'post'. If no method is specified the params map will be used.
@gilbertbw
Copy link
Author

still fails to return POST data but collisions in the param map can now be avoided by specifying type of param you are looking for

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

Successfully merging this pull request may close these issues.

2 participants