Skip to content

Commit 8e62824

Browse files
Merge branch 'main' of github.com:GabrielRozendo/aptabase_flutter
2 parents 1d3631b + 2e5e60e commit 8e62824

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

lib/aptabase_flutter.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ enum _SendResult { disabled, success, discard, tryAgain }
2727
class Aptabase {
2828
Aptabase._();
2929

30-
static const _sdkVersion = "aptabase_flutter@0.4.1";
30+
static const _sdkVersion = "aptabase_flutter@0.4.2";
3131
static const _sessionTimeout = Duration(hours: 1);
3232

3333
static const Map<String, String> _hosts = {
@@ -39,9 +39,9 @@ class Aptabase {
3939

4040
static final _http = newUniversalHttpClient();
4141

42-
static late final String _appKey;
42+
static String? _appKey;
43+
static Uri? _apiUrl;
4344
static late final InitOptions _initOptions;
44-
static late final Uri? _apiUrl;
4545
static var _sessionId = _newSessionId();
4646
static var _lastTouchTs = DateTime.now().toUtc();
4747
static Timer? _timer;
@@ -187,7 +187,8 @@ class Aptabase {
187187
String eventName, [
188188
Map<String, dynamic>? props,
189189
]) async {
190-
if (_appKey.isEmpty || _apiUrl == null) {
190+
final appKey = _appKey;
191+
if (_apiUrl == null || appKey == null || appKey.isEmpty) {
191192
_logInfo("Tracking is disabled!");
192193

193194
return;
@@ -211,7 +212,8 @@ class Aptabase {
211212
static Future<_SendResult> _send(List<String> events) async {
212213
try {
213214
final apiUrl = _apiUrl;
214-
if (apiUrl == null) {
215+
final appKey = _appKey;
216+
if (apiUrl == null || appKey == null) {
215217
_logInfo("Tracking is disabled!");
216218

217219
return _SendResult.disabled;
@@ -221,7 +223,7 @@ class Aptabase {
221223

222224
request.followRedirects = true;
223225
request.headers
224-
..set("App-Key", _appKey)
226+
..set("App-Key", appKey)
225227
..set(
226228
HttpHeaders.contentTypeHeader,
227229
"application/json; charset=UTF-8",

pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: aptabase_flutter
22
description: "Flutter SDK for Aptabase: Open Source Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps"
3-
version: 0.4.1
3+
version: 0.4.2
44
homepage: https://aptabase.com
55
repository: https://github.com/aptabase/aptabase_flutter
66
issue_tracker: https://github.com/aptabase/aptabase_flutter/issues
@@ -12,10 +12,10 @@ environment:
1212
dependencies:
1313
flutter:
1414
sdk: flutter
15-
package_info_plus: ^8.0.0
16-
device_info_plus: ^11.3.3
17-
universal_io: ^2.2.2
18-
shared_preferences: ^2.5.3
15+
package_info_plus: any
16+
device_info_plus: any
17+
universal_io: any
18+
shared_preferences: any
1919

2020
dev_dependencies:
2121
flutter_test:

0 commit comments

Comments
 (0)