Force close the http-client on IOAnalytics.close() (#155)
force close the http-client on IOAnalytics.close()
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de81b95..408a819 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 4.0.1
+- Force close the http client from `IOAnalytics.close()`.
+ This prevents lingering requests from making the application hang.
+
## 4.0.0
- Publishing a null safe stable release.
diff --git a/lib/src/usage_impl_io.dart b/lib/src/usage_impl_io.dart
index 62388ad..c692f6a 100644
--- a/lib/src/usage_impl_io.dart
+++ b/lib/src/usage_impl_io.dart
@@ -102,7 +102,11 @@
}
@override
- void close() => _client?.close();
+ void close() {
+ // Do a force close to ensure that lingering requests will not stall the
+ // program.
+ _client?.close(force: true);
+ }
}
JsonEncoder _jsonEncoder = JsonEncoder.withIndent(' ');
diff --git a/pubspec.yaml b/pubspec.yaml
index 42b2e18..36738fd 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
name: usage
-version: 4.0.0
+version: 4.0.1
description: A Google Analytics wrapper for command-line, web, and Flutter apps.
homepage: https://github.com/dart-lang/usage