Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

fix(HttpConfig): Remove the optional argument to the default ctor #1285

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/core_dom/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -755,5 +755,7 @@ class Http {
class HttpConfig {
final Duration coalesceDuration;

HttpConfig({this.coalesceDuration});
HttpConfig(): coalesceDuration = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

"Uninitialized variables have an initial value of null." from the dart spec, but no downside to be extra explicit.


HttpConfig.withOptions({this.coalesceDuration});
}
2 changes: 1 addition & 1 deletion lib/core_dom/module_internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CoreDomModule extends Module {
bind(HttpDefaultHeaders);
bind(HttpDefaults);
bind(HttpInterceptors);
bind(HttpConfig, toValue: new HttpConfig());
bind(HttpConfig);
bind(Animate);
bind(ViewCache);
bind(BrowserCookies);
Expand Down
4 changes: 2 additions & 2 deletions test/core_dom/http_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1426,8 +1426,8 @@ void main() {

describe('coalesce', () {
beforeEachModule((Module module) {
var coalesceDuration = new Duration(milliseconds: 100);
module.bind(HttpConfig, toValue: new HttpConfig(coalesceDuration: coalesceDuration));
var duration = new Duration(milliseconds: 100);
module.bind(HttpConfig, toValue: new HttpConfig.withOptions(coalesceDuration: duration));
});

it('should coalesce requests', async((Http http) {
Expand Down