diff --git a/lib/src/appspector_plugin.dart b/lib/src/appspector_plugin.dart index e20497f..d40c107 100644 --- a/lib/src/appspector_plugin.dart +++ b/lib/src/appspector_plugin.dart @@ -73,7 +73,8 @@ class AppSpectorPlugin { AppSpectorPlugin._privateConstructor(); - AppSpectorPlugin._withConfig(Config config, Function(String)? sessionUrlListener) { + AppSpectorPlugin._withConfig( + Config config, Function(String)? sessionUrlListener) { HttpOverrides.global = AppSpectorHttpOverrides(); _requestReceiver.observeChannel(); _channel.setMethodCallHandler(_handlePluginCalls); @@ -112,7 +113,9 @@ class AppSpectorPlugin { final sharedInstance = shared(); final isStarted = await sharedInstance.isStarted(); if (!isStarted) { - return new AppSpectorPlugin._withConfig(config, sharedInstance._sessionUrlListener)._init(config); + return new AppSpectorPlugin._withConfig( + config, sharedInstance._sessionUrlListener) + ._init(config); } } @@ -131,7 +134,8 @@ class AppSpectorPlugin { Future start() => _channel.invokeMethod("start"); /// Returns true if sdk is started - Future isStarted() => _channel.invokeMethod("isStarted").then((value) => value ?? false); + Future isStarted() => + _channel.invokeMethod("isStarted").then((value) => value ?? false); /// Set metadata value Future setMetadataValue(String key, String value) => diff --git a/lib/src/http/client.dart b/lib/src/http/client.dart index f71af9d..b9c0384 100644 --- a/lib/src/http/client.dart +++ b/lib/src/http/client.dart @@ -63,22 +63,18 @@ class AppSpectorHttpClient implements HttpClient { } @override - set authenticate( - Future Function(Uri url, String scheme, String? realm)? f) { - _httpClient.authenticate = f; + set authenticate(value) { + _httpClient.authenticate = value; } @override - set authenticateProxy( - Future Function(String host, int port, String scheme, String? realm)? - f) { - _httpClient.authenticateProxy = f; + set authenticateProxy(value) { + _httpClient.authenticateProxy = value; } @override - set badCertificateCallback( - bool Function(X509Certificate cert, String host, int port)? callback) { - _httpClient.badCertificateCallback = callback; + set badCertificateCallback(value) { + _httpClient.badCertificateCallback = value; } @override @@ -136,8 +132,8 @@ class AppSpectorHttpClient implements HttpClient { @override Future open( String method, String host, int port, String path) { - final tracker = HttpEventTracker.fromHost( - method, _uidGenerator(), host, port, path); + final tracker = + HttpEventTracker.fromHost(method, _uidGenerator(), host, port, path); return _httpClient.open(method, host, port, path).then((request) { return HttpRequestWrapper(request, tracker); }).catchError((e) { diff --git a/lib/src/http/request_wrapper.dart b/lib/src/http/request_wrapper.dart index 49edbfd..d1abfa5 100644 --- a/lib/src/http/request_wrapper.dart +++ b/lib/src/http/request_wrapper.dart @@ -10,10 +10,10 @@ class HttpRequestWrapper extends HttpClientRequest { final HttpEventTracker _httpEventTracker; @override - Encoding get encoding => _httpClientRequest.encoding; + Encoding get encoding => _httpClientRequest.encoding; @override - set encoding(Encoding value) => _httpClientRequest.encoding = value; + set encoding(Encoding value) => _httpClientRequest.encoding = value; @override int get contentLength => _httpClientRequest.contentLength; @@ -37,7 +37,8 @@ class HttpRequestWrapper extends HttpClientRequest { bool get persistentConnection => _httpClientRequest.persistentConnection; @override - set persistentConnection(bool value) => _httpClientRequest.persistentConnection = value; + set persistentConnection(bool value) => + _httpClientRequest.persistentConnection = value; @override int get maxRedirects => _httpClientRequest.maxRedirects; @@ -82,8 +83,8 @@ class HttpRequestWrapper extends HttpClientRequest { final HttpClientResponse response = await _httpClientRequest.close(); return new HttpResponseWrapper( response, - response - .transform(StreamTransformer.fromHandlers(handleData: (List data, EventSink> sink) { + response.transform(StreamTransformer.fromHandlers( + handleData: (List data, EventSink> sink) { sink.add(data); body.addAll(data); }, handleError: (error, stackTrace, sink) { diff --git a/lib/src/log/logger.dart b/lib/src/log/logger.dart index 5ec5c9b..2c2f7c0 100644 --- a/lib/src/log/logger.dart +++ b/lib/src/log/logger.dart @@ -1,7 +1,6 @@ import 'package:appspector/src/event_sender.dart'; class Logger { - static void v(String tag, String message, [Object? error, StackTrace? stackTrace]) { log(LogLevel.VERBOSE, tag, message, error, stackTrace); @@ -42,7 +41,6 @@ class Logger { } EventSender.sendEvent(new _LogEvent(level, tag, message)); } - } class _LogEvent extends Event { diff --git a/lib/src/monitors.dart b/lib/src/monitors.dart index 2f9c14f..cf46b26 100644 --- a/lib/src/monitors.dart +++ b/lib/src/monitors.dart @@ -4,17 +4,18 @@ enum SupportedPlatform { android, ios } class Monitor { /// Monitor identifier final String id; + /// List of platforms which support this monitor final List platforms; - const Monitor._androidMonitor(this.id) : - platforms = const [SupportedPlatform.android]; + const Monitor._androidMonitor(this.id) + : platforms = const [SupportedPlatform.android]; - const Monitor._iosMonitor(this.id) : - platforms = const [SupportedPlatform.ios]; + const Monitor._iosMonitor(this.id) + : platforms = const [SupportedPlatform.ios]; - const Monitor._commonMonitor(this.id) : - platforms = const [SupportedPlatform.android, SupportedPlatform.ios]; + const Monitor._commonMonitor(this.id) + : platforms = const [SupportedPlatform.android, SupportedPlatform.ios]; } /// Identifiers for supported monitors @@ -29,15 +30,26 @@ class Monitors { static const location = const Monitor._commonMonitor("location"); static const performance = const Monitor._commonMonitor("performance"); static const sqLite = const Monitor._commonMonitor("sqlite"); - static const sharedPreferences = const Monitor._androidMonitor("shared-preferences"); + static const sharedPreferences = + const Monitor._androidMonitor("shared-preferences"); static const analytics = const Monitor._iosMonitor("analytics"); static const notification = const Monitor._iosMonitor("notification-center"); static const userDefaults = const Monitor._iosMonitor("user-defaults"); static const coreData = const Monitor._iosMonitor("ios-core-data"); static List all() => [ - http, logs, screenshot, environment, location, performance, sqLite, fileSystem, - analytics, notification, userDefaults, coreData, - sharedPreferences - ]; + http, + logs, + screenshot, + environment, + location, + performance, + sqLite, + fileSystem, + analytics, + notification, + userDefaults, + coreData, + sharedPreferences + ]; }