Simply implement snippet running.

This commit is contained in:
LollipopKit
2021-11-06 14:05:03 +08:00
parent 7c34530821
commit e0fb591dea
17 changed files with 305 additions and 34 deletions

View File

@@ -6,7 +6,10 @@ class Analysis {
static const _url = 'https://countly.xuty.cc';
static const _key = '80372a2a66424b32d0ac8991bfa1ef058bd36b1f';
static bool _enabled = false;
static Future<void> init(bool debug) async {
_enabled = true;
await Countly.setLoggingEnabled(debug);
await Countly.init(_url, _key);
await Countly.start();
@@ -15,10 +18,14 @@ class Analysis {
}
static void recordView(String view) {
Countly.recordView(view);
if (_enabled) {
Countly.recordView(view);
}
}
static void recordException(Object exception, [bool fatal = false]) {
Countly.logException(exception.toString(), !fatal, null);
if (_enabled) {
Countly.logException(exception.toString(), !fatal, null);
}
}
}