From c7ecacae3e9d1b3c4ccacfa78e46b96b68d9bc58 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 18 Jun 2024 15:41:16 +0200 Subject: [PATCH 1/8] external web package sample --- .gitignore | 2 +- dart/lib/sentry.dart | 2 + .../enricher/enricher_event_processor.dart | 3 +- .../web_enricher_event_processor.dart | 29 ++++---- dart/lib/src/sentry.dart | 4 +- dart/lib/src/sentry_options.dart | 2 + dart/lib/src/web/http_window.dart | 70 +++++++++++++++++++ dart/lib/src/web/noop_window.dart | 55 +++++++++++++++ dart/lib/src/web/web_window.dart | 8 +++ dart/lib/src/web/window.dart | 36 ++++++++++ flutter/example/lib/main.dart | 4 ++ flutter/example/pubspec.yaml | 3 +- flutter/example/pubspec_overrides.yaml | 2 + .../flutter_enricher_event_processor.dart | 2 +- web/.gitignore | 7 ++ web/CHANGELOG.md | 3 + web/README.md | 39 +++++++++++ web/analysis_options.yaml | 30 ++++++++ web/lib/sentry_web.dart | 8 +++ web/lib/src/noop_window.dart | 53 ++++++++++++++ web/lib/src/sentry_web_base.dart | 10 +++ web/lib/src/web_window.dart | 68 ++++++++++++++++++ web/pubspec.yaml | 16 +++++ web/pubspec_overrides.yaml | 3 + 24 files changed, 438 insertions(+), 21 deletions(-) create mode 100644 dart/lib/src/web/http_window.dart create mode 100644 dart/lib/src/web/noop_window.dart create mode 100644 dart/lib/src/web/web_window.dart create mode 100644 dart/lib/src/web/window.dart create mode 100644 web/.gitignore create mode 100644 web/CHANGELOG.md create mode 100644 web/README.md create mode 100644 web/analysis_options.yaml create mode 100644 web/lib/sentry_web.dart create mode 100644 web/lib/src/noop_window.dart create mode 100644 web/lib/src/sentry_web_base.dart create mode 100644 web/lib/src/web_window.dart create mode 100644 web/pubspec.yaml create mode 100644 web/pubspec_overrides.yaml diff --git a/.gitignore b/.gitignore index 1f40d0ebb1..63e89519c7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ build/ .cxx/ .vscode/ - .test_coverage.dart dart/coverage/* logging/coverage/* @@ -25,6 +24,7 @@ sqflite/coverage/* drift/coverage/* hive/coverage/* isar/coverage/* +web/coverage/* pubspec.lock Podfile.lock diff --git a/dart/lib/sentry.dart b/dart/lib/sentry.dart index f416d0b797..4ebd03fac2 100644 --- a/dart/lib/sentry.dart +++ b/dart/lib/sentry.dart @@ -54,3 +54,5 @@ export 'src/sentry_span_operations.dart'; export 'src/utils.dart'; // spotlight debugging export 'src/spotlight.dart'; +// Window wrappers +export 'src/web/window.dart'; diff --git a/dart/lib/src/event_processor/enricher/enricher_event_processor.dart b/dart/lib/src/event_processor/enricher/enricher_event_processor.dart index 78d19738bd..0fa0f0d8dd 100644 --- a/dart/lib/src/event_processor/enricher/enricher_event_processor.dart +++ b/dart/lib/src/event_processor/enricher/enricher_event_processor.dart @@ -1,7 +1,8 @@ import '../../event_processor.dart'; import '../../sentry_options.dart'; import 'io_enricher_event_processor.dart' - if (dart.library.html) 'web_enricher_event_processor.dart'; + if (dart.library.html) 'web_enricher_event_processor.dart' + if (dart.library.js_interop) 'web_enricher_event_processor.dart'; abstract class EnricherEventProcessor implements EventProcessor { factory EnricherEventProcessor(SentryOptions options) => diff --git a/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart b/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart index e51cff4b71..8c0fdb2090 100644 --- a/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart +++ b/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart @@ -1,11 +1,13 @@ -import 'dart:html' as html show window, Window; - import '../../../sentry.dart'; import 'enricher_event_processor.dart'; +import '../../web/noop_window.dart' + if (dart.library.html) '../../web/http_window.dart' + if (dart.library.js_interop) '../../web/web_window.dart'; + EnricherEventProcessor enricherEventProcessor(SentryOptions options) { return WebEnricherEventProcessor( - html.window, + createWindow(options), options, ); } @@ -16,7 +18,7 @@ class WebEnricherEventProcessor implements EnricherEventProcessor { this._options, ); - final html.Window _window; + final Window _window; final SentryOptions _options; @@ -60,11 +62,11 @@ class WebEnricherEventProcessor implements EnricherEventProcessor { memorySize: device?.memorySize ?? _getMemorySize(), orientation: device?.orientation ?? _getScreenOrientation(), screenHeightPixels: device?.screenHeightPixels ?? - _window.screen?.available.height.toInt(), + _window.screen.availableHeight, screenWidthPixels: - device?.screenWidthPixels ?? _window.screen?.available.width.toInt(), + device?.screenWidthPixels ?? _window.screen.availableWidth, screenDensity: - device?.screenDensity ?? _window.devicePixelRatio.toDouble(), + device?.screenDensity ?? _window.devicePixelRatio, ); } @@ -77,14 +79,11 @@ class WebEnricherEventProcessor implements EnricherEventProcessor { SentryOrientation? _getScreenOrientation() { // https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation - final screenOrientation = _window.screen?.orientation; - if (screenOrientation != null) { - if (screenOrientation.type?.startsWith('portrait') ?? false) { - return SentryOrientation.portrait; - } - if (screenOrientation.type?.startsWith('landscape') ?? false) { - return SentryOrientation.landscape; - } + final screenOrientation = _window.screen.orientation; + if (screenOrientation == ScreenOrientation.portrait) { + return SentryOrientation.portrait; + } else if (screenOrientation == ScreenOrientation.landscape) { + return SentryOrientation.landscape; } return null; } diff --git a/dart/lib/src/sentry.dart b/dart/lib/src/sentry.dart index 1873cd6308..361f301994 100644 --- a/dart/lib/src/sentry.dart +++ b/dart/lib/src/sentry.dart @@ -45,13 +45,14 @@ class Sentry { }) async { final sentryOptions = options ?? SentryOptions(); - await _initDefaultValues(sentryOptions); + _setEnvironmentVariables(sentryOptions); try { final config = optionsConfiguration(sentryOptions); if (config is Future) { await config; } + await _initDefaultValues(sentryOptions); } catch (exception, stackTrace) { sentryOptions.logger( SentryLevel.error, @@ -73,7 +74,6 @@ class Sentry { } static Future _initDefaultValues(SentryOptions options) async { - _setEnvironmentVariables(options); // Throws when running on the browser if (!options.platformChecker.isWeb) { diff --git a/dart/lib/src/sentry_options.dart b/dart/lib/src/sentry_options.dart index 956f81c056..34183468c5 100644 --- a/dart/lib/src/sentry_options.dart +++ b/dart/lib/src/sentry_options.dart @@ -443,6 +443,8 @@ class SentryOptions { /// ``` Spotlight spotlight = Spotlight(enabled: false); + Window? Function() window = () { return null; }; + SentryOptions({this.dsn, PlatformChecker? checker}) { if (checker != null) { platformChecker = checker; diff --git a/dart/lib/src/web/http_window.dart b/dart/lib/src/web/http_window.dart new file mode 100644 index 0000000000..5ceefa3b3c --- /dev/null +++ b/dart/lib/src/web/http_window.dart @@ -0,0 +1,70 @@ +import 'dart:html' as html show window, Window; + +import '../sentry_options.dart'; +import 'window.dart'; + +Window createWindow(SentryOptions options) { + return HttpWindow(html.window); +} + +class HttpWindow implements Window { + HttpWindow(this._window); + + final html.Window _window; + + @override + WindowScreen get screen => HttpWindowScreen(_window); + + @override + WindowNavigator get navigator => HttpWindowNavigator(_window); + + @override + WindowLocation get location => HttpWindowLocation(_window); + + @override + double get devicePixelRatio => _window.devicePixelRatio.toDouble(); +} + +class HttpWindowScreen implements WindowScreen { + HttpWindowScreen(this._window); + + final html.Window _window; + + @override + int get availableHeight => _window.screen?.available.height.toInt() ?? 0; + + @override + int get availableWidth => _window.screen?.available.width.toInt() ?? 0; + + @override + ScreenOrientation? get orientation => + _window.screen?.orientation?.type == "portrait" + ? ScreenOrientation.portrait + : _window.screen?.orientation?.type == "landscape" + ? ScreenOrientation.landscape + : null; +} + +class HttpWindowNavigator implements WindowNavigator { + HttpWindowNavigator(this._window); + + final html.Window _window; + + @override + String get userAgent => _window.navigator.userAgent; + + @override + bool? get onLine => _window.navigator.onLine; + + @override + double? get deviceMemory => _window.navigator.deviceMemory?.toDouble(); +} + +class HttpWindowLocation implements WindowLocation { + HttpWindowLocation(this._window); + + final html.Window _window; + + @override + String? get pathname => _window.location.pathname; +} \ No newline at end of file diff --git a/dart/lib/src/web/noop_window.dart b/dart/lib/src/web/noop_window.dart new file mode 100644 index 0000000000..946f47b075 --- /dev/null +++ b/dart/lib/src/web/noop_window.dart @@ -0,0 +1,55 @@ + +import '../sentry_options.dart'; +import 'window.dart'; + +Window createWindow(SentryOptions options) { + return NoopWindow(); +} + +class NoopWindow implements Window { + + @override + WindowScreen get screen => NoopWindowScreen(); + + @override + WindowNavigator get navigator => NoopWindowNavigator(); + + @override + WindowLocation get location => NoopWindowLocation(); + + @override + double get devicePixelRatio => 1.0; +} + +class NoopWindowScreen implements WindowScreen { + NoopWindowScreen(); + + @override + int get availableHeight => 0; + + @override + int get availableWidth => 0; + + @override + ScreenOrientation? get orientation => null; +} + +class NoopWindowNavigator implements WindowNavigator { + NoopWindowNavigator(); + + @override + String get userAgent => "--"; + + @override + bool? get onLine => null; + + @override + double? get deviceMemory => null; +} + +class NoopWindowLocation implements WindowLocation { + NoopWindowLocation(); + + @override + String? get pathname => null; +} diff --git a/dart/lib/src/web/web_window.dart b/dart/lib/src/web/web_window.dart new file mode 100644 index 0000000000..259a650d0e --- /dev/null +++ b/dart/lib/src/web/web_window.dart @@ -0,0 +1,8 @@ +import '../sentry_options.dart'; +import 'noop_window.dart'; +import 'window.dart'; + +// Get window from options or noop +Window createWindow(SentryOptions options) { + return options.window() ?? NoopWindow(); +} diff --git a/dart/lib/src/web/window.dart b/dart/lib/src/web/window.dart new file mode 100644 index 0000000000..e055a36e83 --- /dev/null +++ b/dart/lib/src/web/window.dart @@ -0,0 +1,36 @@ +abstract class Window { + + WindowScreen get screen; + WindowNavigator get navigator; + WindowLocation get location; + + double get devicePixelRatio; +} + +abstract class WindowScreen { + WindowScreen(); + + int get availableHeight; + int get availableWidth; + + ScreenOrientation? get orientation; +} + +abstract class WindowNavigator { + WindowNavigator(); + + String get userAgent; + + bool? get onLine; + + double? get deviceMemory; +} + +abstract class WindowLocation { + String? get pathname; +} + +enum ScreenOrientation { + portrait, + landscape, +} diff --git a/flutter/example/lib/main.dart b/flutter/example/lib/main.dart index 86da143e31..311454336c 100644 --- a/flutter/example/lib/main.dart +++ b/flutter/example/lib/main.dart @@ -30,6 +30,8 @@ import 'package:sentry_dio/sentry_dio.dart'; import 'package:sentry_logging/sentry_logging.dart'; import 'package:sentry_hive/sentry_hive.dart'; +import 'package:sentry_web/sentry_web.dart' as sentry_web; + // ATTENTION: Change the DSN below with your own to see the events in Sentry. Get one at sentry.io const String exampleDsn = 'https://e85b375ffb9f43cf8bdf9787768149e0@o447951.ingest.sentry.io/5428562'; @@ -43,6 +45,7 @@ var _isIntegrationTest = false; final GlobalKey navigatorKey = GlobalKey(); Future main() async { + await setupSentry( () => runApp( SentryWidget( @@ -64,6 +67,7 @@ Future setupSentry( }) async { await SentryFlutter.init( (options) { + options.window = sentry_web.SentryWeb.createWindow; options.dsn = exampleDsn; options.tracesSampleRate = 1.0; options.profilesSampleRate = 1.0; diff --git a/flutter/example/pubspec.yaml b/flutter/example/pubspec.yaml index 1f53f5d1c3..f9f30b1a7c 100644 --- a/flutter/example/pubspec.yaml +++ b/flutter/example/pubspec.yaml @@ -5,7 +5,7 @@ version: 8.3.0 publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' flutter: '>=3.0.0' dependencies: @@ -20,6 +20,7 @@ dependencies: sentry_hive: sentry_drift: sentry_isar: + sentry_web: universal_platform: ^1.0.0 feedback: ^2.0.0 provider: ^6.0.0 diff --git a/flutter/example/pubspec_overrides.yaml b/flutter/example/pubspec_overrides.yaml index a392cc626d..f772bf0faa 100644 --- a/flutter/example/pubspec_overrides.yaml +++ b/flutter/example/pubspec_overrides.yaml @@ -17,3 +17,5 @@ dependency_overrides: path: ../../drift sentry_isar: path: ../../isar + sentry_web: + path: ../../web diff --git a/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart b/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart index 0ea1b731d6..86f7b20af1 100644 --- a/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart +++ b/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart @@ -195,7 +195,7 @@ class FlutterEnricherEventProcessor implements EventProcessor { SentryOperatingSystem _getOperatingSystem(SentryOperatingSystem? os) { return (os ?? SentryOperatingSystem()).copyWith( // ignore: deprecated_member_use - theme: os?.theme ?? describeEnum(window.platformBrightness), + theme: os?.theme /*?? describeEnum(window.platformBrightness)*/, // TODO ); } diff --git a/web/.gitignore b/web/.gitignore new file mode 100644 index 0000000000..3cceda5578 --- /dev/null +++ b/web/.gitignore @@ -0,0 +1,7 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md new file mode 100644 index 0000000000..effe43c82c --- /dev/null +++ b/web/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000000..8b55e735b5 --- /dev/null +++ b/web/README.md @@ -0,0 +1,39 @@ + + +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. + +## Features + +TODO: List what your package can do. Maybe include images, gifs, or videos. + +## Getting started + +TODO: List prerequisites and provide or point to information on how to +start using the package. + +## Usage + +TODO: Include short and useful examples for package users. Add longer examples +to `/example` folder. + +```dart +const like = 'sample'; +``` + +## Additional information + +TODO: Tell users more about the package: where to find more information, how to +contribute to the package, how to file issues, what response they can expect +from the package authors, and more. diff --git a/web/analysis_options.yaml b/web/analysis_options.yaml new file mode 100644 index 0000000000..dee8927aaf --- /dev/null +++ b/web/analysis_options.yaml @@ -0,0 +1,30 @@ +# This file configures the static analysis results for your project (errors, +# warnings, and lints). +# +# This enables the 'recommended' set of lints from `package:lints`. +# This set helps identify many issues that may lead to problems when running +# or consuming Dart code, and enforces writing Dart using a single, idiomatic +# style and format. +# +# If you want a smaller set of lints you can change this to specify +# 'package:lints/core.yaml'. These are just the most critical lints +# (the recommended set includes the core lints). +# The core lints are also what is used by pub.dev for scoring packages. + +include: package:lints/recommended.yaml + +# Uncomment the following section to specify additional rules. + +# linter: +# rules: +# - camel_case_types + +# analyzer: +# exclude: +# - path/to/excluded/files/** + +# For more information about the core and recommended set of lints, see +# https://dart.dev/go/core-lints + +# For additional information about configuring this file, see +# https://dart.dev/guides/language/analysis-options diff --git a/web/lib/sentry_web.dart b/web/lib/sentry_web.dart new file mode 100644 index 0000000000..d5ee15f927 --- /dev/null +++ b/web/lib/sentry_web.dart @@ -0,0 +1,8 @@ +/// Support for doing something awesome. +/// +/// More dartdocs go here. +library sentry_web; + +import 'src/sentry_web_base.dart'; + +export 'src/sentry_web_base.dart'; diff --git a/web/lib/src/noop_window.dart b/web/lib/src/noop_window.dart new file mode 100644 index 0000000000..206dbbc005 --- /dev/null +++ b/web/lib/src/noop_window.dart @@ -0,0 +1,53 @@ +import 'package:sentry/sentry.dart'; + +Window createWebWindow() { + return NoopWindow(); +} + +class NoopWindow implements Window { + + @override + WindowScreen get screen => NoopScreen(); + + @override + WindowNavigator get navigator => NoopNavigator(); + + @override + WindowLocation get location => NoopLocation(); + + @override + double get devicePixelRatio => 1.0; +} + +class NoopScreen implements WindowScreen { + NoopScreen(); + + @override + int get availableHeight => 0; + + @override + int get availableWidth => 0; + + @override + ScreenOrientation? get orientation => null; +} + +class NoopNavigator implements WindowNavigator { + NoopNavigator(); + + @override + String get userAgent => "--"; + + @override + bool? get onLine => null; + + @override + double? get deviceMemory => null; +} + +class NoopLocation implements WindowLocation { + NoopLocation(); + + @override + String? get pathname => null; +} diff --git a/web/lib/src/sentry_web_base.dart b/web/lib/src/sentry_web_base.dart new file mode 100644 index 0000000000..56f2a46bf1 --- /dev/null +++ b/web/lib/src/sentry_web_base.dart @@ -0,0 +1,10 @@ +import 'package:sentry/sentry.dart'; + +import 'noop_window.dart' + if (dart.library.js_interop) 'web_window.dart'; + +class SentryWeb { + static Window createWindow() { + return createWebWindow(); + } +} diff --git a/web/lib/src/web_window.dart b/web/lib/src/web_window.dart new file mode 100644 index 0000000000..0ee8840447 --- /dev/null +++ b/web/lib/src/web_window.dart @@ -0,0 +1,68 @@ +import 'package:sentry/sentry.dart'; +import 'package:web/web.dart' as web show window, Window; + +Window createWebWindow() { + return WebWindow(web.window); +} + +class WebWindow implements Window { + WebWindow(this._window); + + final web.Window _window; + + @override + WindowScreen get screen => WebScreen(_window); + + @override + WindowNavigator get navigator => WebWindowNavigator(_window); + + @override + WindowLocation get location => WebWindowLocation(_window); + + @override + double get devicePixelRatio => _window.devicePixelRatio.toDouble(); +} + +class WebScreen implements WindowScreen { + WebScreen(this._window); + + final web.Window _window; + + @override + int get availableHeight => _window.screen.availHeight.toInt() ?? 0; + + @override + int get availableWidth => _window.screen.availWidth.toInt() ?? 0; + + @override + ScreenOrientation? get orientation => + _window.screen.orientation.type == "portrait" + ? ScreenOrientation.portrait + : _window.screen.orientation.type == "landscape" + ? ScreenOrientation.landscape + : null; +} + +class WebWindowNavigator implements WindowNavigator { + WebWindowNavigator(this._window); + + final web.Window _window; + + @override + String get userAgent => _window.navigator.userAgent; + + @override + bool? get onLine => _window.navigator.onLine; + + @override + double? get deviceMemory => 0.0; +} + +class WebWindowLocation implements WindowLocation { + WebWindowLocation(this._window); + + final web.Window _window; + + @override + String? get pathname => _window.location.pathname; +} diff --git a/web/pubspec.yaml b/web/pubspec.yaml new file mode 100644 index 0000000000..9248afcf18 --- /dev/null +++ b/web/pubspec.yaml @@ -0,0 +1,16 @@ +name: sentry_web +description: A starting point for Dart libraries or applications. +version: 1.0.0 +# repository: https://github.com/my_org/my_repo + +environment: + sdk: ^3.4.3 + +# Add regular dependencies here. +dependencies: + sentry: 8.2.0 + web: ^0.5.1 + +dev_dependencies: + lints: ^3.0.0 + test: ^1.24.0 diff --git a/web/pubspec_overrides.yaml b/web/pubspec_overrides.yaml new file mode 100644 index 0000000000..16e71d16f0 --- /dev/null +++ b/web/pubspec_overrides.yaml @@ -0,0 +1,3 @@ +dependency_overrides: + sentry: + path: ../dart From 016ffc1a3325f63954056243eac83970fa9e5ebb Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 18 Jun 2024 15:49:52 +0200 Subject: [PATCH 2/8] lower dart sdk --- web/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/pubspec.yaml b/web/pubspec.yaml index 9248afcf18..8f5af1c90f 100644 --- a/web/pubspec.yaml +++ b/web/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 # repository: https://github.com/my_org/my_repo environment: - sdk: ^3.4.3 + sdk: ^3.3.0 # Add regular dependencies here. dependencies: From bd8e02db2afaf20f18f2503a349fcfa46dc4cb12 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 18 Jun 2024 17:29:44 +0200 Subject: [PATCH 3/8] comment out all dependencies that hinder wasm build --- flutter/example/lib/auto_close_screen.dart | 18 +- .../example/lib/drift/connection/native.dart | 14 +- .../lib/drift/connection/unsupported.dart | 34 +- flutter/example/lib/drift/database.dart | 36 +- flutter/example/lib/drift/database.g.dart | 538 ++++---- flutter/example/lib/isar/user.dart | 24 +- flutter/example/lib/isar/user.g.dart | 1106 ++++++++--------- flutter/example/lib/main.dart | 432 +++---- flutter/example/pubspec.yaml | 30 +- flutter/example/pubspec_overrides.yaml | 28 +- .../cocoa/noop_sentry_native_cocoa.dart | 8 + flutter/lib/src/native/factory_real.dart | 7 +- 12 files changed, 1144 insertions(+), 1131 deletions(-) create mode 100644 flutter/lib/src/native/cocoa/noop_sentry_native_cocoa.dart diff --git a/flutter/example/lib/auto_close_screen.dart b/flutter/example/lib/auto_close_screen.dart index 6848678b4c..894fce8153 100644 --- a/flutter/example/lib/auto_close_screen.dart +++ b/flutter/example/lib/auto_close_screen.dart @@ -1,6 +1,6 @@ -import 'package:dio/dio.dart'; +// import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; -import 'package:sentry_dio/sentry_dio.dart'; +// import 'package:sentry_dio/sentry_dio.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'main.dart'; @@ -25,13 +25,13 @@ class AutoCloseScreenState extends State { } Future _doComplexOperationThenClose() async { - final dio = Dio(); - dio.addSentry(); - try { - await dio.get(exampleUrl); - } catch (exception, stackTrace) { - await Sentry.captureException(exception, stackTrace: stackTrace); - } + // final dio = Dio(); + // dio.addSentry(); + // try { + // await dio.get(exampleUrl); + // } catch (exception, stackTrace) { + // await Sentry.captureException(exception, stackTrace: stackTrace); + // } SentryFlutter.reportFullyDisplayed(); // ignore: use_build_context_synchronously Navigator.of(context).pop(); diff --git a/flutter/example/lib/drift/connection/native.dart b/flutter/example/lib/drift/connection/native.dart index fb9987412e..39758c84e1 100644 --- a/flutter/example/lib/drift/connection/native.dart +++ b/flutter/example/lib/drift/connection/native.dart @@ -1,7 +1,7 @@ -import 'package:drift/backends.dart'; -import 'package:drift/drift.dart'; -import 'package:drift/native.dart'; - -QueryExecutor inMemoryExecutor() { - return NativeDatabase.memory(); -} +// import 'package:drift/backends.dart'; +// import 'package:drift/drift.dart'; +// import 'package:drift/native.dart'; +// +// QueryExecutor inMemoryExecutor() { +// return NativeDatabase.memory(); +// } diff --git a/flutter/example/lib/drift/connection/unsupported.dart b/flutter/example/lib/drift/connection/unsupported.dart index 87b9b45143..61832b07de 100644 --- a/flutter/example/lib/drift/connection/unsupported.dart +++ b/flutter/example/lib/drift/connection/unsupported.dart @@ -1,17 +1,17 @@ -import 'package:drift/drift.dart'; - -Never _unsupported() { - throw UnsupportedError( - 'No suitable database implementation was found on this platform.'); -} - -// Depending on the platform the app is compiled to, the following stubs will -// be replaced with the methods in native.dart or web.dart - -QueryExecutor inMemoryExecutor() { - return _unsupported(); -} - -Future validateDatabaseSchema(GeneratedDatabase database) async { - _unsupported(); -} +// import 'package:drift/drift.dart'; +// +// Never _unsupported() { +// throw UnsupportedError( +// 'No suitable database implementation was found on this platform.'); +// } +// +// // Depending on the platform the app is compiled to, the following stubs will +// // be replaced with the methods in native.dart or web.dart +// +// QueryExecutor inMemoryExecutor() { +// return _unsupported(); +// } +// +// Future validateDatabaseSchema(GeneratedDatabase database) async { +// _unsupported(); +// } diff --git a/flutter/example/lib/drift/database.dart b/flutter/example/lib/drift/database.dart index 914a87ca1a..1bb5d4c747 100644 --- a/flutter/example/lib/drift/database.dart +++ b/flutter/example/lib/drift/database.dart @@ -1,18 +1,18 @@ -import 'package:drift/drift.dart'; - -part 'database.g.dart'; - -class TodoItems extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get title => text().withLength(min: 6, max: 32)(); - TextColumn get content => text().named('body')(); - IntColumn get category => integer().nullable()(); -} - -@DriftDatabase(tables: [TodoItems]) -class AppDatabase extends _$AppDatabase { - AppDatabase(super.e); - - @override - int get schemaVersion => 1; -} +// import 'package:drift/drift.dart'; +// +// part 'database.g.dart'; +// +// class TodoItems extends Table { +// IntColumn get id => integer().autoIncrement()(); +// TextColumn get title => text().withLength(min: 6, max: 32)(); +// TextColumn get content => text().named('body')(); +// IntColumn get category => integer().nullable()(); +// } +// +// @DriftDatabase(tables: [TodoItems]) +// class AppDatabase extends _$AppDatabase { +// AppDatabase(super.e); +// +// @override +// int get schemaVersion => 1; +// } diff --git a/flutter/example/lib/drift/database.g.dart b/flutter/example/lib/drift/database.g.dart index 1f9d234456..045becd83d 100644 --- a/flutter/example/lib/drift/database.g.dart +++ b/flutter/example/lib/drift/database.g.dart @@ -1,269 +1,269 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'database.dart'; - -// ignore_for_file: type=lint -class $TodoItemsTable extends TodoItems - with TableInfo<$TodoItemsTable, TodoItem> { - @override - final GeneratedDatabase attachedDatabase; - final String? _alias; - $TodoItemsTable(this.attachedDatabase, [this._alias]); - static const VerificationMeta _idMeta = const VerificationMeta('id'); - @override - late final GeneratedColumn id = GeneratedColumn( - 'id', aliasedName, false, - hasAutoIncrement: true, - type: DriftSqlType.int, - requiredDuringInsert: false, - defaultConstraints: - GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); - static const VerificationMeta _titleMeta = const VerificationMeta('title'); - @override - late final GeneratedColumn title = GeneratedColumn( - 'title', aliasedName, false, - additionalChecks: - GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 32), - type: DriftSqlType.string, - requiredDuringInsert: true); - static const VerificationMeta _contentMeta = - const VerificationMeta('content'); - @override - late final GeneratedColumn content = GeneratedColumn( - 'body', aliasedName, false, - type: DriftSqlType.string, requiredDuringInsert: true); - static const VerificationMeta _categoryMeta = - const VerificationMeta('category'); - @override - late final GeneratedColumn category = GeneratedColumn( - 'category', aliasedName, true, - type: DriftSqlType.int, requiredDuringInsert: false); - @override - List get $columns => [id, title, content, category]; - @override - String get aliasedName => _alias ?? actualTableName; - @override - String get actualTableName => $name; - static const String $name = 'todo_items'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('id')) { - context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); - } - if (data.containsKey('title')) { - context.handle( - _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); - } else if (isInserting) { - context.missing(_titleMeta); - } - if (data.containsKey('body')) { - context.handle(_contentMeta, - content.isAcceptableOrUnknown(data['body']!, _contentMeta)); - } else if (isInserting) { - context.missing(_contentMeta); - } - if (data.containsKey('category')) { - context.handle(_categoryMeta, - category.isAcceptableOrUnknown(data['category']!, _categoryMeta)); - } - return context; - } - - @override - Set get $primaryKey => {id}; - @override - TodoItem map(Map data, {String? tablePrefix}) { - final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; - return TodoItem( - id: attachedDatabase.typeMapping - .read(DriftSqlType.int, data['${effectivePrefix}id'])!, - title: attachedDatabase.typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}title'])!, - content: attachedDatabase.typeMapping - .read(DriftSqlType.string, data['${effectivePrefix}body'])!, - category: attachedDatabase.typeMapping - .read(DriftSqlType.int, data['${effectivePrefix}category']), - ); - } - - @override - $TodoItemsTable createAlias(String alias) { - return $TodoItemsTable(attachedDatabase, alias); - } -} - -class TodoItem extends DataClass implements Insertable { - final int id; - final String title; - final String content; - final int? category; - const TodoItem( - {required this.id, - required this.title, - required this.content, - this.category}); - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['id'] = Variable(id); - map['title'] = Variable(title); - map['body'] = Variable(content); - if (!nullToAbsent || category != null) { - map['category'] = Variable(category); - } - return map; - } - - TodoItemsCompanion toCompanion(bool nullToAbsent) { - return TodoItemsCompanion( - id: Value(id), - title: Value(title), - content: Value(content), - category: category == null && nullToAbsent - ? const Value.absent() - : Value(category), - ); - } - - factory TodoItem.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= driftRuntimeOptions.defaultSerializer; - return TodoItem( - id: serializer.fromJson(json['id']), - title: serializer.fromJson(json['title']), - content: serializer.fromJson(json['content']), - category: serializer.fromJson(json['category']), - ); - } - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= driftRuntimeOptions.defaultSerializer; - return { - 'id': serializer.toJson(id), - 'title': serializer.toJson(title), - 'content': serializer.toJson(content), - 'category': serializer.toJson(category), - }; - } - - TodoItem copyWith( - {int? id, - String? title, - String? content, - Value category = const Value.absent()}) => - TodoItem( - id: id ?? this.id, - title: title ?? this.title, - content: content ?? this.content, - category: category.present ? category.value : this.category, - ); - @override - String toString() { - return (StringBuffer('TodoItem(') - ..write('id: $id, ') - ..write('title: $title, ') - ..write('content: $content, ') - ..write('category: $category') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(id, title, content, category); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is TodoItem && - other.id == this.id && - other.title == this.title && - other.content == this.content && - other.category == this.category); -} - -class TodoItemsCompanion extends UpdateCompanion { - final Value id; - final Value title; - final Value content; - final Value category; - const TodoItemsCompanion({ - this.id = const Value.absent(), - this.title = const Value.absent(), - this.content = const Value.absent(), - this.category = const Value.absent(), - }); - TodoItemsCompanion.insert({ - this.id = const Value.absent(), - required String title, - required String content, - this.category = const Value.absent(), - }) : title = Value(title), - content = Value(content); - static Insertable custom({ - Expression? id, - Expression? title, - Expression? content, - Expression? category, - }) { - return RawValuesInsertable({ - if (id != null) 'id': id, - if (title != null) 'title': title, - if (content != null) 'body': content, - if (category != null) 'category': category, - }); - } - - TodoItemsCompanion copyWith( - {Value? id, - Value? title, - Value? content, - Value? category}) { - return TodoItemsCompanion( - id: id ?? this.id, - title: title ?? this.title, - content: content ?? this.content, - category: category ?? this.category, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = Variable(id.value); - } - if (title.present) { - map['title'] = Variable(title.value); - } - if (content.present) { - map['body'] = Variable(content.value); - } - if (category.present) { - map['category'] = Variable(category.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('TodoItemsCompanion(') - ..write('id: $id, ') - ..write('title: $title, ') - ..write('content: $content, ') - ..write('category: $category') - ..write(')')) - .toString(); - } -} - -abstract class _$AppDatabase extends GeneratedDatabase { - _$AppDatabase(QueryExecutor e) : super(e); - late final $TodoItemsTable todoItems = $TodoItemsTable(this); - @override - Iterable> get allTables => - allSchemaEntities.whereType>(); - @override - List get allSchemaEntities => [todoItems]; -} +// // GENERATED CODE - DO NOT MODIFY BY HAND +// +// part of 'database.dart'; +// +// // ignore_for_file: type=lint +// class $TodoItemsTable extends TodoItems +// with TableInfo<$TodoItemsTable, TodoItem> { +// @override +// final GeneratedDatabase attachedDatabase; +// final String? _alias; +// $TodoItemsTable(this.attachedDatabase, [this._alias]); +// static const VerificationMeta _idMeta = const VerificationMeta('id'); +// @override +// late final GeneratedColumn id = GeneratedColumn( +// 'id', aliasedName, false, +// hasAutoIncrement: true, +// type: DriftSqlType.int, +// requiredDuringInsert: false, +// defaultConstraints: +// GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); +// static const VerificationMeta _titleMeta = const VerificationMeta('title'); +// @override +// late final GeneratedColumn title = GeneratedColumn( +// 'title', aliasedName, false, +// additionalChecks: +// GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 32), +// type: DriftSqlType.string, +// requiredDuringInsert: true); +// static const VerificationMeta _contentMeta = +// const VerificationMeta('content'); +// @override +// late final GeneratedColumn content = GeneratedColumn( +// 'body', aliasedName, false, +// type: DriftSqlType.string, requiredDuringInsert: true); +// static const VerificationMeta _categoryMeta = +// const VerificationMeta('category'); +// @override +// late final GeneratedColumn category = GeneratedColumn( +// 'category', aliasedName, true, +// type: DriftSqlType.int, requiredDuringInsert: false); +// @override +// List get $columns => [id, title, content, category]; +// @override +// String get aliasedName => _alias ?? actualTableName; +// @override +// String get actualTableName => $name; +// static const String $name = 'todo_items'; +// @override +// VerificationContext validateIntegrity(Insertable instance, +// {bool isInserting = false}) { +// final context = VerificationContext(); +// final data = instance.toColumns(true); +// if (data.containsKey('id')) { +// context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); +// } +// if (data.containsKey('title')) { +// context.handle( +// _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); +// } else if (isInserting) { +// context.missing(_titleMeta); +// } +// if (data.containsKey('body')) { +// context.handle(_contentMeta, +// content.isAcceptableOrUnknown(data['body']!, _contentMeta)); +// } else if (isInserting) { +// context.missing(_contentMeta); +// } +// if (data.containsKey('category')) { +// context.handle(_categoryMeta, +// category.isAcceptableOrUnknown(data['category']!, _categoryMeta)); +// } +// return context; +// } +// +// @override +// Set get $primaryKey => {id}; +// @override +// TodoItem map(Map data, {String? tablePrefix}) { +// final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; +// return TodoItem( +// id: attachedDatabase.typeMapping +// .read(DriftSqlType.int, data['${effectivePrefix}id'])!, +// title: attachedDatabase.typeMapping +// .read(DriftSqlType.string, data['${effectivePrefix}title'])!, +// content: attachedDatabase.typeMapping +// .read(DriftSqlType.string, data['${effectivePrefix}body'])!, +// category: attachedDatabase.typeMapping +// .read(DriftSqlType.int, data['${effectivePrefix}category']), +// ); +// } +// +// @override +// $TodoItemsTable createAlias(String alias) { +// return $TodoItemsTable(attachedDatabase, alias); +// } +// } +// +// class TodoItem extends DataClass implements Insertable { +// final int id; +// final String title; +// final String content; +// final int? category; +// const TodoItem( +// {required this.id, +// required this.title, +// required this.content, +// this.category}); +// @override +// Map toColumns(bool nullToAbsent) { +// final map = {}; +// map['id'] = Variable(id); +// map['title'] = Variable(title); +// map['body'] = Variable(content); +// if (!nullToAbsent || category != null) { +// map['category'] = Variable(category); +// } +// return map; +// } +// +// TodoItemsCompanion toCompanion(bool nullToAbsent) { +// return TodoItemsCompanion( +// id: Value(id), +// title: Value(title), +// content: Value(content), +// category: category == null && nullToAbsent +// ? const Value.absent() +// : Value(category), +// ); +// } +// +// factory TodoItem.fromJson(Map json, +// {ValueSerializer? serializer}) { +// serializer ??= driftRuntimeOptions.defaultSerializer; +// return TodoItem( +// id: serializer.fromJson(json['id']), +// title: serializer.fromJson(json['title']), +// content: serializer.fromJson(json['content']), +// category: serializer.fromJson(json['category']), +// ); +// } +// @override +// Map toJson({ValueSerializer? serializer}) { +// serializer ??= driftRuntimeOptions.defaultSerializer; +// return { +// 'id': serializer.toJson(id), +// 'title': serializer.toJson(title), +// 'content': serializer.toJson(content), +// 'category': serializer.toJson(category), +// }; +// } +// +// TodoItem copyWith( +// {int? id, +// String? title, +// String? content, +// Value category = const Value.absent()}) => +// TodoItem( +// id: id ?? this.id, +// title: title ?? this.title, +// content: content ?? this.content, +// category: category.present ? category.value : this.category, +// ); +// @override +// String toString() { +// return (StringBuffer('TodoItem(') +// ..write('id: $id, ') +// ..write('title: $title, ') +// ..write('content: $content, ') +// ..write('category: $category') +// ..write(')')) +// .toString(); +// } +// +// @override +// int get hashCode => Object.hash(id, title, content, category); +// @override +// bool operator ==(Object other) => +// identical(this, other) || +// (other is TodoItem && +// other.id == this.id && +// other.title == this.title && +// other.content == this.content && +// other.category == this.category); +// } +// +// class TodoItemsCompanion extends UpdateCompanion { +// final Value id; +// final Value title; +// final Value content; +// final Value category; +// const TodoItemsCompanion({ +// this.id = const Value.absent(), +// this.title = const Value.absent(), +// this.content = const Value.absent(), +// this.category = const Value.absent(), +// }); +// TodoItemsCompanion.insert({ +// this.id = const Value.absent(), +// required String title, +// required String content, +// this.category = const Value.absent(), +// }) : title = Value(title), +// content = Value(content); +// static Insertable custom({ +// Expression? id, +// Expression? title, +// Expression? content, +// Expression? category, +// }) { +// return RawValuesInsertable({ +// if (id != null) 'id': id, +// if (title != null) 'title': title, +// if (content != null) 'body': content, +// if (category != null) 'category': category, +// }); +// } +// +// TodoItemsCompanion copyWith( +// {Value? id, +// Value? title, +// Value? content, +// Value? category}) { +// return TodoItemsCompanion( +// id: id ?? this.id, +// title: title ?? this.title, +// content: content ?? this.content, +// category: category ?? this.category, +// ); +// } +// +// @override +// Map toColumns(bool nullToAbsent) { +// final map = {}; +// if (id.present) { +// map['id'] = Variable(id.value); +// } +// if (title.present) { +// map['title'] = Variable(title.value); +// } +// if (content.present) { +// map['body'] = Variable(content.value); +// } +// if (category.present) { +// map['category'] = Variable(category.value); +// } +// return map; +// } +// +// @override +// String toString() { +// return (StringBuffer('TodoItemsCompanion(') +// ..write('id: $id, ') +// ..write('title: $title, ') +// ..write('content: $content, ') +// ..write('category: $category') +// ..write(')')) +// .toString(); +// } +// } +// +// abstract class _$AppDatabase extends GeneratedDatabase { +// _$AppDatabase(QueryExecutor e) : super(e); +// late final $TodoItemsTable todoItems = $TodoItemsTable(this); +// @override +// Iterable> get allTables => +// allSchemaEntities.whereType>(); +// @override +// List get allSchemaEntities => [todoItems]; +// } diff --git a/flutter/example/lib/isar/user.dart b/flutter/example/lib/isar/user.dart index f255d2389d..3ca768ae45 100644 --- a/flutter/example/lib/isar/user.dart +++ b/flutter/example/lib/isar/user.dart @@ -1,12 +1,12 @@ -import 'package:isar/isar.dart'; - -part 'user.g.dart'; - -@collection -class User { - Id id = Isar.autoIncrement; - - String? name; - - int? age; -} +// import 'package:isar/isar.dart'; +// +// part 'user.g.dart'; +// +// @collection +// class User { +// Id id = Isar.autoIncrement; +// +// String? name; +// +// int? age; +// } diff --git a/flutter/example/lib/isar/user.g.dart b/flutter/example/lib/isar/user.g.dart index c4d7ef985f..c90f98fa8f 100644 --- a/flutter/example/lib/isar/user.g.dart +++ b/flutter/example/lib/isar/user.g.dart @@ -1,553 +1,553 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'user.dart'; - -// ************************************************************************** -// IsarCollectionGenerator -// ************************************************************************** - -// coverage:ignore-file -// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types - -extension GetUserCollection on Isar { - IsarCollection get users => this.collection(); -} - -final UserSchema = CollectionSchema( - name: r'User', - id: BigInt.parse("-7838171048429979076").toInt(), - properties: { - r'age': PropertySchema( - id: BigInt.parse("0").toInt(), - name: r'age', - type: IsarType.long, - ), - r'name': PropertySchema( - id: BigInt.parse("1").toInt(), - name: r'name', - type: IsarType.string, - ) - }, - estimateSize: _userEstimateSize, - serialize: _userSerialize, - deserialize: _userDeserialize, - deserializeProp: _userDeserializeProp, - idName: r'id', - indexes: {}, - links: {}, - embeddedSchemas: {}, - getId: _userGetId, - getLinks: _userGetLinks, - attach: _userAttach, - version: '3.1.0', -); - -int _userEstimateSize( - User object, - List offsets, - Map> allOffsets, -) { - var bytesCount = offsets.last; - { - final value = object.name; - if (value != null) { - bytesCount += 3 + value.length * 3; - } - } - return bytesCount; -} - -void _userSerialize( - User object, - IsarWriter writer, - List offsets, - Map> allOffsets, -) { - writer.writeLong(offsets[0], object.age); - writer.writeString(offsets[1], object.name); -} - -User _userDeserialize( - Id id, - IsarReader reader, - List offsets, - Map> allOffsets, -) { - final object = User(); - object.age = reader.readLongOrNull(offsets[0]); - object.id = id; - object.name = reader.readStringOrNull(offsets[1]); - return object; -} - -P _userDeserializeProp

( - IsarReader reader, - int propertyId, - int offset, - Map> allOffsets, -) { - switch (propertyId) { - case 0: - return (reader.readLongOrNull(offset)) as P; - case 1: - return (reader.readStringOrNull(offset)) as P; - default: - throw IsarError('Unknown property with id $propertyId'); - } -} - -Id _userGetId(User object) { - return object.id; -} - -List> _userGetLinks(User object) { - return []; -} - -void _userAttach(IsarCollection col, Id id, User object) { - object.id = id; -} - -extension UserQueryWhereSort on QueryBuilder { - QueryBuilder anyId() { - return QueryBuilder.apply(this, (query) { - return query.addWhereClause(const IdWhereClause.any()); - }); - } -} - -extension UserQueryWhere on QueryBuilder { - QueryBuilder idEqualTo(Id id) { - return QueryBuilder.apply(this, (query) { - return query.addWhereClause(IdWhereClause.between( - lower: id, - upper: id, - )); - }); - } - - QueryBuilder idNotEqualTo(Id id) { - return QueryBuilder.apply(this, (query) { - if (query.whereSort == Sort.asc) { - return query - .addWhereClause( - IdWhereClause.lessThan(upper: id, includeUpper: false), - ) - .addWhereClause( - IdWhereClause.greaterThan(lower: id, includeLower: false), - ); - } else { - return query - .addWhereClause( - IdWhereClause.greaterThan(lower: id, includeLower: false), - ) - .addWhereClause( - IdWhereClause.lessThan(upper: id, includeUpper: false), - ); - } - }); - } - - QueryBuilder idGreaterThan(Id id, - {bool include = false}) { - return QueryBuilder.apply(this, (query) { - return query.addWhereClause( - IdWhereClause.greaterThan(lower: id, includeLower: include), - ); - }); - } - - QueryBuilder idLessThan(Id id, - {bool include = false}) { - return QueryBuilder.apply(this, (query) { - return query.addWhereClause( - IdWhereClause.lessThan(upper: id, includeUpper: include), - ); - }); - } - - QueryBuilder idBetween( - Id lowerId, - Id upperId, { - bool includeLower = true, - bool includeUpper = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addWhereClause(IdWhereClause.between( - lower: lowerId, - includeLower: includeLower, - upper: upperId, - includeUpper: includeUpper, - )); - }); - } -} - -extension UserQueryFilter on QueryBuilder { - QueryBuilder ageIsNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const FilterCondition.isNull( - property: r'age', - )); - }); - } - - QueryBuilder ageIsNotNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const FilterCondition.isNotNull( - property: r'age', - )); - }); - } - - QueryBuilder ageEqualTo(int? value) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.equalTo( - property: r'age', - value: value, - )); - }); - } - - QueryBuilder ageGreaterThan( - int? value, { - bool include = false, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.greaterThan( - include: include, - property: r'age', - value: value, - )); - }); - } - - QueryBuilder ageLessThan( - int? value, { - bool include = false, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.lessThan( - include: include, - property: r'age', - value: value, - )); - }); - } - - QueryBuilder ageBetween( - int? lower, - int? upper, { - bool includeLower = true, - bool includeUpper = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.between( - property: r'age', - lower: lower, - includeLower: includeLower, - upper: upper, - includeUpper: includeUpper, - )); - }); - } - - QueryBuilder idEqualTo(Id value) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.equalTo( - property: r'id', - value: value, - )); - }); - } - - QueryBuilder idGreaterThan( - Id value, { - bool include = false, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.greaterThan( - include: include, - property: r'id', - value: value, - )); - }); - } - - QueryBuilder idLessThan( - Id value, { - bool include = false, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.lessThan( - include: include, - property: r'id', - value: value, - )); - }); - } - - QueryBuilder idBetween( - Id lower, - Id upper, { - bool includeLower = true, - bool includeUpper = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.between( - property: r'id', - lower: lower, - includeLower: includeLower, - upper: upper, - includeUpper: includeUpper, - )); - }); - } - - QueryBuilder nameIsNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const FilterCondition.isNull( - property: r'name', - )); - }); - } - - QueryBuilder nameIsNotNull() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(const FilterCondition.isNotNull( - property: r'name', - )); - }); - } - - QueryBuilder nameEqualTo( - String? value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.equalTo( - property: r'name', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameGreaterThan( - String? value, { - bool include = false, - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.greaterThan( - include: include, - property: r'name', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameLessThan( - String? value, { - bool include = false, - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.lessThan( - include: include, - property: r'name', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameBetween( - String? lower, - String? upper, { - bool includeLower = true, - bool includeUpper = true, - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.between( - property: r'name', - lower: lower, - includeLower: includeLower, - upper: upper, - includeUpper: includeUpper, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameStartsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.startsWith( - property: r'name', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameEndsWith( - String value, { - bool caseSensitive = true, - }) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.endsWith( - property: r'name', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameContains(String value, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.contains( - property: r'name', - value: value, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameMatches(String pattern, - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.matches( - property: r'name', - wildcard: pattern, - caseSensitive: caseSensitive, - )); - }); - } - - QueryBuilder nameIsEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.equalTo( - property: r'name', - value: '', - )); - }); - } - - QueryBuilder nameIsNotEmpty() { - return QueryBuilder.apply(this, (query) { - return query.addFilterCondition(FilterCondition.greaterThan( - property: r'name', - value: '', - )); - }); - } -} - -extension UserQueryObject on QueryBuilder {} - -extension UserQueryLinks on QueryBuilder {} - -extension UserQuerySortBy on QueryBuilder { - QueryBuilder sortByAge() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'age', Sort.asc); - }); - } - - QueryBuilder sortByAgeDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'age', Sort.desc); - }); - } - - QueryBuilder sortByName() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'name', Sort.asc); - }); - } - - QueryBuilder sortByNameDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'name', Sort.desc); - }); - } -} - -extension UserQuerySortThenBy on QueryBuilder { - QueryBuilder thenByAge() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'age', Sort.asc); - }); - } - - QueryBuilder thenByAgeDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'age', Sort.desc); - }); - } - - QueryBuilder thenById() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'id', Sort.asc); - }); - } - - QueryBuilder thenByIdDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'id', Sort.desc); - }); - } - - QueryBuilder thenByName() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'name', Sort.asc); - }); - } - - QueryBuilder thenByNameDesc() { - return QueryBuilder.apply(this, (query) { - return query.addSortBy(r'name', Sort.desc); - }); - } -} - -extension UserQueryWhereDistinct on QueryBuilder { - QueryBuilder distinctByAge() { - return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(r'age'); - }); - } - - QueryBuilder distinctByName( - {bool caseSensitive = true}) { - return QueryBuilder.apply(this, (query) { - return query.addDistinctBy(r'name', caseSensitive: caseSensitive); - }); - } -} - -extension UserQueryProperty on QueryBuilder { - QueryBuilder idProperty() { - return QueryBuilder.apply(this, (query) { - return query.addPropertyName(r'id'); - }); - } - - QueryBuilder ageProperty() { - return QueryBuilder.apply(this, (query) { - return query.addPropertyName(r'age'); - }); - } - - QueryBuilder nameProperty() { - return QueryBuilder.apply(this, (query) { - return query.addPropertyName(r'name'); - }); - } -} +// // GENERATED CODE - DO NOT MODIFY BY HAND +// +// part of 'user.dart'; +// +// // ************************************************************************** +// // IsarCollectionGenerator +// // ************************************************************************** +// +// // coverage:ignore-file +// // ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types +// +// extension GetUserCollection on Isar { +// IsarCollection get users => this.collection(); +// } +// +// final UserSchema = CollectionSchema( +// name: r'User', +// id: BigInt.parse("-7838171048429979076").toInt(), +// properties: { +// r'age': PropertySchema( +// id: BigInt.parse("0").toInt(), +// name: r'age', +// type: IsarType.long, +// ), +// r'name': PropertySchema( +// id: BigInt.parse("1").toInt(), +// name: r'name', +// type: IsarType.string, +// ) +// }, +// estimateSize: _userEstimateSize, +// serialize: _userSerialize, +// deserialize: _userDeserialize, +// deserializeProp: _userDeserializeProp, +// idName: r'id', +// indexes: {}, +// links: {}, +// embeddedSchemas: {}, +// getId: _userGetId, +// getLinks: _userGetLinks, +// attach: _userAttach, +// version: '3.1.0', +// ); +// +// int _userEstimateSize( +// User object, +// List offsets, +// Map> allOffsets, +// ) { +// var bytesCount = offsets.last; +// { +// final value = object.name; +// if (value != null) { +// bytesCount += 3 + value.length * 3; +// } +// } +// return bytesCount; +// } +// +// void _userSerialize( +// User object, +// IsarWriter writer, +// List offsets, +// Map> allOffsets, +// ) { +// writer.writeLong(offsets[0], object.age); +// writer.writeString(offsets[1], object.name); +// } +// +// User _userDeserialize( +// Id id, +// IsarReader reader, +// List offsets, +// Map> allOffsets, +// ) { +// final object = User(); +// object.age = reader.readLongOrNull(offsets[0]); +// object.id = id; +// object.name = reader.readStringOrNull(offsets[1]); +// return object; +// } +// +// P _userDeserializeProp

( +// IsarReader reader, +// int propertyId, +// int offset, +// Map> allOffsets, +// ) { +// switch (propertyId) { +// case 0: +// return (reader.readLongOrNull(offset)) as P; +// case 1: +// return (reader.readStringOrNull(offset)) as P; +// default: +// throw IsarError('Unknown property with id $propertyId'); +// } +// } +// +// Id _userGetId(User object) { +// return object.id; +// } +// +// List> _userGetLinks(User object) { +// return []; +// } +// +// void _userAttach(IsarCollection col, Id id, User object) { +// object.id = id; +// } +// +// extension UserQueryWhereSort on QueryBuilder { +// QueryBuilder anyId() { +// return QueryBuilder.apply(this, (query) { +// return query.addWhereClause(const IdWhereClause.any()); +// }); +// } +// } +// +// extension UserQueryWhere on QueryBuilder { +// QueryBuilder idEqualTo(Id id) { +// return QueryBuilder.apply(this, (query) { +// return query.addWhereClause(IdWhereClause.between( +// lower: id, +// upper: id, +// )); +// }); +// } +// +// QueryBuilder idNotEqualTo(Id id) { +// return QueryBuilder.apply(this, (query) { +// if (query.whereSort == Sort.asc) { +// return query +// .addWhereClause( +// IdWhereClause.lessThan(upper: id, includeUpper: false), +// ) +// .addWhereClause( +// IdWhereClause.greaterThan(lower: id, includeLower: false), +// ); +// } else { +// return query +// .addWhereClause( +// IdWhereClause.greaterThan(lower: id, includeLower: false), +// ) +// .addWhereClause( +// IdWhereClause.lessThan(upper: id, includeUpper: false), +// ); +// } +// }); +// } +// +// QueryBuilder idGreaterThan(Id id, +// {bool include = false}) { +// return QueryBuilder.apply(this, (query) { +// return query.addWhereClause( +// IdWhereClause.greaterThan(lower: id, includeLower: include), +// ); +// }); +// } +// +// QueryBuilder idLessThan(Id id, +// {bool include = false}) { +// return QueryBuilder.apply(this, (query) { +// return query.addWhereClause( +// IdWhereClause.lessThan(upper: id, includeUpper: include), +// ); +// }); +// } +// +// QueryBuilder idBetween( +// Id lowerId, +// Id upperId, { +// bool includeLower = true, +// bool includeUpper = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addWhereClause(IdWhereClause.between( +// lower: lowerId, +// includeLower: includeLower, +// upper: upperId, +// includeUpper: includeUpper, +// )); +// }); +// } +// } +// +// extension UserQueryFilter on QueryBuilder { +// QueryBuilder ageIsNull() { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(const FilterCondition.isNull( +// property: r'age', +// )); +// }); +// } +// +// QueryBuilder ageIsNotNull() { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(const FilterCondition.isNotNull( +// property: r'age', +// )); +// }); +// } +// +// QueryBuilder ageEqualTo(int? value) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.equalTo( +// property: r'age', +// value: value, +// )); +// }); +// } +// +// QueryBuilder ageGreaterThan( +// int? value, { +// bool include = false, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.greaterThan( +// include: include, +// property: r'age', +// value: value, +// )); +// }); +// } +// +// QueryBuilder ageLessThan( +// int? value, { +// bool include = false, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.lessThan( +// include: include, +// property: r'age', +// value: value, +// )); +// }); +// } +// +// QueryBuilder ageBetween( +// int? lower, +// int? upper, { +// bool includeLower = true, +// bool includeUpper = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.between( +// property: r'age', +// lower: lower, +// includeLower: includeLower, +// upper: upper, +// includeUpper: includeUpper, +// )); +// }); +// } +// +// QueryBuilder idEqualTo(Id value) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.equalTo( +// property: r'id', +// value: value, +// )); +// }); +// } +// +// QueryBuilder idGreaterThan( +// Id value, { +// bool include = false, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.greaterThan( +// include: include, +// property: r'id', +// value: value, +// )); +// }); +// } +// +// QueryBuilder idLessThan( +// Id value, { +// bool include = false, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.lessThan( +// include: include, +// property: r'id', +// value: value, +// )); +// }); +// } +// +// QueryBuilder idBetween( +// Id lower, +// Id upper, { +// bool includeLower = true, +// bool includeUpper = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.between( +// property: r'id', +// lower: lower, +// includeLower: includeLower, +// upper: upper, +// includeUpper: includeUpper, +// )); +// }); +// } +// +// QueryBuilder nameIsNull() { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(const FilterCondition.isNull( +// property: r'name', +// )); +// }); +// } +// +// QueryBuilder nameIsNotNull() { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(const FilterCondition.isNotNull( +// property: r'name', +// )); +// }); +// } +// +// QueryBuilder nameEqualTo( +// String? value, { +// bool caseSensitive = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.equalTo( +// property: r'name', +// value: value, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameGreaterThan( +// String? value, { +// bool include = false, +// bool caseSensitive = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.greaterThan( +// include: include, +// property: r'name', +// value: value, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameLessThan( +// String? value, { +// bool include = false, +// bool caseSensitive = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.lessThan( +// include: include, +// property: r'name', +// value: value, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameBetween( +// String? lower, +// String? upper, { +// bool includeLower = true, +// bool includeUpper = true, +// bool caseSensitive = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.between( +// property: r'name', +// lower: lower, +// includeLower: includeLower, +// upper: upper, +// includeUpper: includeUpper, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameStartsWith( +// String value, { +// bool caseSensitive = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.startsWith( +// property: r'name', +// value: value, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameEndsWith( +// String value, { +// bool caseSensitive = true, +// }) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.endsWith( +// property: r'name', +// value: value, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameContains(String value, +// {bool caseSensitive = true}) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.contains( +// property: r'name', +// value: value, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameMatches(String pattern, +// {bool caseSensitive = true}) { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.matches( +// property: r'name', +// wildcard: pattern, +// caseSensitive: caseSensitive, +// )); +// }); +// } +// +// QueryBuilder nameIsEmpty() { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.equalTo( +// property: r'name', +// value: '', +// )); +// }); +// } +// +// QueryBuilder nameIsNotEmpty() { +// return QueryBuilder.apply(this, (query) { +// return query.addFilterCondition(FilterCondition.greaterThan( +// property: r'name', +// value: '', +// )); +// }); +// } +// } +// +// extension UserQueryObject on QueryBuilder {} +// +// extension UserQueryLinks on QueryBuilder {} +// +// extension UserQuerySortBy on QueryBuilder { +// QueryBuilder sortByAge() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'age', Sort.asc); +// }); +// } +// +// QueryBuilder sortByAgeDesc() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'age', Sort.desc); +// }); +// } +// +// QueryBuilder sortByName() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'name', Sort.asc); +// }); +// } +// +// QueryBuilder sortByNameDesc() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'name', Sort.desc); +// }); +// } +// } +// +// extension UserQuerySortThenBy on QueryBuilder { +// QueryBuilder thenByAge() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'age', Sort.asc); +// }); +// } +// +// QueryBuilder thenByAgeDesc() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'age', Sort.desc); +// }); +// } +// +// QueryBuilder thenById() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'id', Sort.asc); +// }); +// } +// +// QueryBuilder thenByIdDesc() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'id', Sort.desc); +// }); +// } +// +// QueryBuilder thenByName() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'name', Sort.asc); +// }); +// } +// +// QueryBuilder thenByNameDesc() { +// return QueryBuilder.apply(this, (query) { +// return query.addSortBy(r'name', Sort.desc); +// }); +// } +// } +// +// extension UserQueryWhereDistinct on QueryBuilder { +// QueryBuilder distinctByAge() { +// return QueryBuilder.apply(this, (query) { +// return query.addDistinctBy(r'age'); +// }); +// } +// +// QueryBuilder distinctByName( +// {bool caseSensitive = true}) { +// return QueryBuilder.apply(this, (query) { +// return query.addDistinctBy(r'name', caseSensitive: caseSensitive); +// }); +// } +// } +// +// extension UserQueryProperty on QueryBuilder { +// QueryBuilder idProperty() { +// return QueryBuilder.apply(this, (query) { +// return query.addPropertyName(r'id'); +// }); +// } +// +// QueryBuilder ageProperty() { +// return QueryBuilder.apply(this, (query) { +// return query.addPropertyName(r'age'); +// }); +// } +// +// QueryBuilder nameProperty() { +// return QueryBuilder.apply(this, (query) { +// return query.addPropertyName(r'name'); +// }); +// } +// } diff --git a/flutter/example/lib/main.dart b/flutter/example/lib/main.dart index 311454336c..0f875003a1 100644 --- a/flutter/example/lib/main.dart +++ b/flutter/example/lib/main.dart @@ -7,13 +7,13 @@ import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:logging/logging.dart'; +// import 'package:logging/logging.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:sentry_drift/sentry_drift.dart'; +// import 'package:sentry_drift/sentry_drift.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; -import 'package:sentry_isar/sentry_isar.dart'; -import 'package:sentry_sqflite/sentry_sqflite.dart'; -import 'package:sqflite/sqflite.dart'; +// import 'package:sentry_isar/sentry_isar.dart'; +// import 'package:sentry_sqflite/sentry_sqflite.dart'; +// import 'package:sqflite/sqflite.dart'; // import 'package:sqflite_common_ffi/sqflite_ffi.dart'; // import 'package:sqflite_common_ffi_web/sqflite_ffi_web.dart'; @@ -25,10 +25,10 @@ import 'drift/database.dart'; import 'drift/connection/connection.dart'; import 'isar/user.dart'; import 'user_feedback_dialog.dart'; -import 'package:dio/dio.dart'; -import 'package:sentry_dio/sentry_dio.dart'; -import 'package:sentry_logging/sentry_logging.dart'; -import 'package:sentry_hive/sentry_hive.dart'; +// import 'package:dio/dio.dart'; +// import 'package:sentry_dio/sentry_dio.dart'; +// import 'package:sentry_logging/sentry_logging.dart'; +// import 'package:sentry_hive/sentry_hive.dart'; import 'package:sentry_web/sentry_web.dart' as sentry_web; @@ -76,7 +76,7 @@ Future setupSentry( options.considerInAppFramesByDefault = false; options.attachThreads = true; options.enableWindowMetricBreadcrumbs = true; - options.addIntegration(LoggingIntegration(minEventLevel: Level.INFO)); + // options.addIntegration(LoggingIntegration(minEventLevel: Level.INFO)); options.sendDefaultPii = true; options.reportSilentFlutterErrors = true; options.attachScreenshot = true; @@ -215,33 +215,33 @@ class MainScaffold extends StatelessWidget { 'Pushes a screen and creates a transaction named \'AutoCloseScreen\' with a child span that finishes after 3 seconds. \nAfter the screen has popped the transaction can then be seen on the performance page.', buttonTitle: 'Route Navigation Observer', ), - if (!UniversalPlatform.isWeb) - TooltipButton( - onPressed: driftTest, - text: - 'Executes CRUD operations on an in-memory with Drift and sends the created transaction to Sentry.', - buttonTitle: 'drift', - ), - if (!UniversalPlatform.isWeb) - TooltipButton( - onPressed: hiveTest, - text: - 'Executes CRUD operations on an in-memory with Hive and sends the created transaction to Sentry.', - buttonTitle: 'hive', - ), - if (!UniversalPlatform.isWeb) - TooltipButton( - onPressed: isarTest, - text: - 'Executes CRUD operations on an in-memory with Isart and sends the created transaction to Sentry.', - buttonTitle: 'isar', - ), - TooltipButton( - onPressed: sqfliteTest, - text: - 'Executes CRUD operations on an in-memory with Hive and sends the created transaction to Sentry.', - buttonTitle: 'sqflite', - ), + // if (!UniversalPlatform.isWeb) + // TooltipButton( + // onPressed: driftTest, + // text: + // 'Executes CRUD operations on an in-memory with Drift and sends the created transaction to Sentry.', + // buttonTitle: 'drift', + // ), + // if (!UniversalPlatform.isWeb) + // TooltipButton( + // onPressed: hiveTest, + // text: + // 'Executes CRUD operations on an in-memory with Hive and sends the created transaction to Sentry.', + // buttonTitle: 'hive', + // ), + // if (!UniversalPlatform.isWeb) + // TooltipButton( + // onPressed: isarTest, + // text: + // 'Executes CRUD operations on an in-memory with Isart and sends the created transaction to Sentry.', + // buttonTitle: 'isar', + // ), + // TooltipButton( + // onPressed: sqfliteTest, + // text: + // 'Executes CRUD operations on an in-memory with Hive and sends the created transaction to Sentry.', + // buttonTitle: 'sqflite', + // ), TooltipButton( onPressed: () => SecondaryScaffold.openSecondaryScaffold(context), text: @@ -363,13 +363,13 @@ class MainScaffold extends StatelessWidget { 'Attaches web request related spans to the transaction and send it to Sentry.', buttonTitle: 'Dart: Web request', ), - TooltipButton( - onPressed: () => makeWebRequestWithDio(context), - key: const Key('dio_web_request'), - text: - 'Attaches web request related spans to the transaction and send it to Sentry.', - buttonTitle: 'Dio: Web request', - ), + // TooltipButton( + // onPressed: () => makeWebRequestWithDio(context), + // key: const Key('dio_web_request'), + // text: + // 'Attaches web request related spans to the transaction and send it to Sentry.', + // buttonTitle: 'Dio: Web request', + // ), TooltipButton( onPressed: () => showDialogWithTextAndImage(context), @@ -526,8 +526,8 @@ class MainScaffold extends StatelessWidget { ), TooltipButton( onPressed: () { - final log = Logger('Logging'); - log.info('My Logging test'); + // final log = Logger('Logging'); + // log.info('My Logging test'); }, text: 'Demonstrates the logging integration. log.info() will create an info event send it to Sentry.', @@ -580,131 +580,131 @@ class MainScaffold extends StatelessWidget { ); } - Future isarTest() async { - final tr = Sentry.startTransaction( - 'isarTest', - 'db', - bindToScope: true, - ); - - final dir = await getApplicationDocumentsDirectory(); - - final isar = await SentryIsar.open( - [UserSchema], - directory: dir.path, - ); - - final newUser = User() - ..name = 'Joe Dirt' - ..age = 36; - - await isar.writeTxn(() async { - await isar.users.put(newUser); // insert & update - }); - - final existingUser = await isar.users.get(newUser.id); // get - - await isar.writeTxn(() async { - await isar.users.delete(existingUser!.id); // delete - }); - - await tr.finish(status: const SpanStatus.ok()); - } - - Future hiveTest() async { - final tr = Sentry.startTransaction( - 'hiveTest', - 'db', - bindToScope: true, - ); - - final appDir = await getApplicationDocumentsDirectory(); - SentryHive.init(appDir.path); - - final catsBox = await SentryHive.openBox('cats'); - await catsBox.put('fluffy', {'name': 'Fluffy', 'age': 4}); - await catsBox.put('loki', {'name': 'Loki', 'age': 2}); - await catsBox.clear(); - await catsBox.close(); - - SentryHive.close(); - - await tr.finish(status: const SpanStatus.ok()); - } - - Future sqfliteTest() async { - final tr = Sentry.startTransaction( - 'sqfliteTest', - 'db', - bindToScope: true, - ); - - // databaseFactory = databaseFactoryFfiWeb; // or databaseFactoryFfi // or SentrySqfliteDatabaseFactory() - - // final sqfDb = await openDatabase(inMemoryDatabasePath); - final db = await openDatabaseWithSentry(inMemoryDatabasePath); - // final db = SentryDatabase(sqfDb); - // final batch = db.batch(); - await db.execute(''' - CREATE TABLE Product ( - id INTEGER PRIMARY KEY, - title TEXT - ) - '''); - final dbTitles = []; - for (int i = 1; i <= 20; i++) { - final title = 'Product $i'; - dbTitles.add(title); - await db.insert('Product', {'title': title}); - } - - await db.query('Product'); - - await db.transaction((txn) async { - await txn - .insert('Product', {'title': 'Product Another one'}); - await txn.delete('Product', - where: 'title = ?', whereArgs: ['Product Another one']); - }); - - await db.delete('Product', where: 'title = ?', whereArgs: ['Product 1']); - - // final batch = db.batch(); - // batch.delete('Product', where: 'title = ?', whereArgs: dbTitles); - // await batch.commit(); - - await db.close(); - - await tr.finish(status: const SpanStatus.ok()); - } - - Future driftTest() async { - final tr = Sentry.startTransaction( - 'driftTest', - 'db', - bindToScope: true, - ); - - final executor = SentryQueryExecutor( - () async => inMemoryExecutor(), - databaseName: 'sentry_in_memory_db', - ); - - final db = AppDatabase(executor); - - await db.into(db.todoItems).insert( - TodoItemsCompanion.insert( - title: 'This is a test thing', - content: 'test', - ), - ); - - await db.select(db.todoItems).get(); - - await db.close(); - - await tr.finish(status: const SpanStatus.ok()); - } + // Future isarTest() async { + // final tr = Sentry.startTransaction( + // 'isarTest', + // 'db', + // bindToScope: true, + // ); + // + // final dir = await getApplicationDocumentsDirectory(); + // + // final isar = await SentryIsar.open( + // [UserSchema], + // directory: dir.path, + // ); + // + // final newUser = User() + // ..name = 'Joe Dirt' + // ..age = 36; + // + // await isar.writeTxn(() async { + // await isar.users.put(newUser); // insert & update + // }); + // + // final existingUser = await isar.users.get(newUser.id); // get + // + // await isar.writeTxn(() async { + // await isar.users.delete(existingUser!.id); // delete + // }); + // + // await tr.finish(status: const SpanStatus.ok()); + // } + + // Future hiveTest() async { + // final tr = Sentry.startTransaction( + // 'hiveTest', + // 'db', + // bindToScope: true, + // ); + // + // final appDir = await getApplicationDocumentsDirectory(); + // SentryHive.init(appDir.path); + // + // final catsBox = await SentryHive.openBox('cats'); + // await catsBox.put('fluffy', {'name': 'Fluffy', 'age': 4}); + // await catsBox.put('loki', {'name': 'Loki', 'age': 2}); + // await catsBox.clear(); + // await catsBox.close(); + // + // SentryHive.close(); + // + // await tr.finish(status: const SpanStatus.ok()); + // } + + // Future sqfliteTest() async { + // final tr = Sentry.startTransaction( + // 'sqfliteTest', + // 'db', + // bindToScope: true, + // ); + // + // // databaseFactory = databaseFactoryFfiWeb; // or databaseFactoryFfi // or SentrySqfliteDatabaseFactory() + // + // // final sqfDb = await openDatabase(inMemoryDatabasePath); + // final db = await openDatabaseWithSentry(inMemoryDatabasePath); + // // final db = SentryDatabase(sqfDb); + // // final batch = db.batch(); + // await db.execute(''' + // CREATE TABLE Product ( + // id INTEGER PRIMARY KEY, + // title TEXT + // ) + // '''); + // final dbTitles = []; + // for (int i = 1; i <= 20; i++) { + // final title = 'Product $i'; + // dbTitles.add(title); + // await db.insert('Product', {'title': title}); + // } + // + // await db.query('Product'); + // + // await db.transaction((txn) async { + // await txn + // .insert('Product', {'title': 'Product Another one'}); + // await txn.delete('Product', + // where: 'title = ?', whereArgs: ['Product Another one']); + // }); + // + // await db.delete('Product', where: 'title = ?', whereArgs: ['Product 1']); + // + // // final batch = db.batch(); + // // batch.delete('Product', where: 'title = ?', whereArgs: dbTitles); + // // await batch.commit(); + // + // await db.close(); + // + // await tr.finish(status: const SpanStatus.ok()); + // } + + // Future driftTest() async { + // final tr = Sentry.startTransaction( + // 'driftTest', + // 'db', + // bindToScope: true, + // ); + // + // final executor = SentryQueryExecutor( + // () async => inMemoryExecutor(), + // databaseName: 'sentry_in_memory_db', + // ); + // + // final db = AppDatabase(executor); + // + // await db.into(db.todoItems).insert( + // TodoItemsCompanion.insert( + // title: 'This is a test thing', + // content: 'test', + // ), + // ); + // + // await db.select(db.todoItems).get(); + // + // await db.close(); + // + // await tr.finish(status: const SpanStatus.ok()); + // } } extension BuildContextExtension on BuildContext { @@ -974,51 +974,51 @@ Future makeWebRequest(BuildContext context) async { ); } -Future makeWebRequestWithDio(BuildContext context) async { - final dio = Dio(); - dio.addSentry(); - - final transaction = Sentry.getSpan() ?? - Sentry.startTransaction( - 'dio-web-request', - 'request', - bindToScope: true, - ); - final span = transaction.startChild( - 'dio', - description: 'desc', - ); - Response? response; - try { - response = await dio.get(exampleUrl); - span.status = const SpanStatus.ok(); - } catch (exception, stackTrace) { - span.throwable = exception; - span.status = const SpanStatus.internalError(); - await Sentry.captureException(exception, stackTrace: stackTrace); - } finally { - await span.finish(); - } - - if (!context.mounted) return; - await showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: Text('Response ${response?.statusCode}'), - content: SingleChildScrollView( - child: Text(response?.data ?? 'failed request'), - ), - actions: [ - MaterialButton( - onPressed: () => Navigator.pop(context), - child: const Text('Close'), - ) - ], - ); - }, - ); -} +// Future makeWebRequestWithDio(BuildContext context) async { +// final dio = Dio(); +// dio.addSentry(); +// +// final transaction = Sentry.getSpan() ?? +// Sentry.startTransaction( +// 'dio-web-request', +// 'request', +// bindToScope: true, +// ); +// final span = transaction.startChild( +// 'dio', +// description: 'desc', +// ); +// Response? response; +// try { +// response = await dio.get(exampleUrl); +// span.status = const SpanStatus.ok(); +// } catch (exception, stackTrace) { +// span.throwable = exception; +// span.status = const SpanStatus.internalError(); +// await Sentry.captureException(exception, stackTrace: stackTrace); +// } finally { +// await span.finish(); +// } +// +// if (!context.mounted) return; +// await showDialog( +// context: context, +// builder: (context) { +// return AlertDialog( +// title: Text('Response ${response?.statusCode}'), +// content: SingleChildScrollView( +// child: Text(response?.data ?? 'failed request'), +// ), +// actions: [ +// MaterialButton( +// onPressed: () => Navigator.pop(context), +// child: const Text('Close'), +// ) +// ], +// ); +// }, +// ); +// } Future showDialogWithTextAndImage(BuildContext context) async { final transaction = Sentry.getSpan() ?? diff --git a/flutter/example/pubspec.yaml b/flutter/example/pubspec.yaml index f9f30b1a7c..5f98637e59 100644 --- a/flutter/example/pubspec.yaml +++ b/flutter/example/pubspec.yaml @@ -13,29 +13,29 @@ dependencies: sdk: flutter sentry: sentry_flutter: - sentry_dio: - sentry_logging: - sentry_sqflite: - sentry_file: - sentry_hive: - sentry_drift: - sentry_isar: +# sentry_dio: +# sentry_logging: +# sentry_sqflite: +# sentry_file: +# sentry_hive: +# sentry_drift: +# sentry_isar: sentry_web: universal_platform: ^1.0.0 feedback: ^2.0.0 provider: ^6.0.0 - dio: any # This gets constrained by `sentry_dio` - sqflite: any # This gets constrained by `sentry_sqflite` - logging: any # This gets constrained by `sentry_logging` - drift: any # This gets constrained by `sentry_drift` - isar: any # This gets constrained by `sentry_isar` - package_info_plus: ^4.0.0 +# dio: any # This gets constrained by `sentry_dio` +# sqflite: any # This gets constrained by `sentry_sqflite` +# logging: any # This gets constrained by `sentry_logging` +# drift: any # This gets constrained by `sentry_drift` +# isar: any # This gets constrained by `sentry_isar` + package_info_plus: ^6.0.0 path_provider: ^2.0.0 #sqflite_common_ffi: ^2.0.0 #sqflite_common_ffi_web: ^0.3.0 http: ^1.0.0 - hive: any # This gets constrained by `sentry_hive` - sqlite3_flutter_libs: ^0.5.0 +# hive: any # This gets constrained by `sentry_hive` +# sqlite3_flutter_libs: ^0.5.0 dev_dependencies: flutter_lints: ^2.0.0 diff --git a/flutter/example/pubspec_overrides.yaml b/flutter/example/pubspec_overrides.yaml index f772bf0faa..df625e9c9e 100644 --- a/flutter/example/pubspec_overrides.yaml +++ b/flutter/example/pubspec_overrides.yaml @@ -3,19 +3,19 @@ dependency_overrides: path: ../../dart sentry_flutter: path: ../ - sentry_dio: - path: ../../dio - sentry_logging: - path: ../../logging - sentry_sqflite: - path: ../../sqflite - sentry_file: - path: ../../file - sentry_hive: - path: ../../hive - sentry_drift: - path: ../../drift - sentry_isar: - path: ../../isar +# sentry_dio: +# path: ../../dio +# sentry_logging: +# path: ../../logging +# sentry_sqflite: +# path: ../../sqflite +# sentry_file: +# path: ../../file +# sentry_hive: +# path: ../../hive +# sentry_drift: +# path: ../../drift +# sentry_isar: +# path: ../../isar sentry_web: path: ../../web diff --git a/flutter/lib/src/native/cocoa/noop_sentry_native_cocoa.dart b/flutter/lib/src/native/cocoa/noop_sentry_native_cocoa.dart new file mode 100644 index 0000000000..770728c377 --- /dev/null +++ b/flutter/lib/src/native/cocoa/noop_sentry_native_cocoa.dart @@ -0,0 +1,8 @@ +import 'package:meta/meta.dart'; + +import '../sentry_native_channel.dart'; + +@internal +class SentryNativeCocoa extends SentryNativeChannel { + SentryNativeCocoa(super.channel); +} diff --git a/flutter/lib/src/native/factory_real.dart b/flutter/lib/src/native/factory_real.dart index d5ee4f5cca..6ffc6e57e3 100644 --- a/flutter/lib/src/native/factory_real.dart +++ b/flutter/lib/src/native/factory_real.dart @@ -1,11 +1,16 @@ import 'package:flutter/services.dart'; import '../../sentry_flutter.dart'; -import 'cocoa/sentry_native_cocoa.dart'; import 'java/sentry_native_java.dart'; import 'sentry_native_binding.dart'; import 'sentry_native_channel.dart'; +import 'cocoa/sentry_native_cocoa.dart' + if (dart.library.js_interop) 'cocoa/noop_sentry_native_cocoa.dart'; + +// import 'cocoa/noop_sentry_native_cocoa.dart' +// if (dart.library.ffi) 'cocoa/sentry_native_cocoa.dart'; + SentryNativeBinding createBinding(PlatformChecker pc, MethodChannel channel) { if (pc.platform.isIOS || pc.platform.isMacOS) { return SentryNativeCocoa(channel); From 7da63f08ebdfba96f53e8d3f5d4e97f97d2fb6d5 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 20 Jun 2024 00:05:36 +0200 Subject: [PATCH 4/8] Update sentry version to 8.3.0 in web pubspec.yaml --- web/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/pubspec.yaml b/web/pubspec.yaml index 8f5af1c90f..9ac8a4b663 100644 --- a/web/pubspec.yaml +++ b/web/pubspec.yaml @@ -8,7 +8,7 @@ environment: # Add regular dependencies here. dependencies: - sentry: 8.2.0 + sentry: 8.3.0 web: ^0.5.1 dev_dependencies: From 55adc7c358d3ef529eff6e4953d4a11e7726f0a2 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 20 Jun 2024 00:08:59 +0200 Subject: [PATCH 5/8] Remove import in sentry_web.dart --- web/lib/sentry_web.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/web/lib/sentry_web.dart b/web/lib/sentry_web.dart index d5ee15f927..6354605bc7 100644 --- a/web/lib/sentry_web.dart +++ b/web/lib/sentry_web.dart @@ -3,6 +3,4 @@ /// More dartdocs go here. library sentry_web; -import 'src/sentry_web_base.dart'; - export 'src/sentry_web_base.dart'; From c8d70332a6217426da6a3e512bf4d328e9b4b450 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 20 Jun 2024 00:34:36 +0200 Subject: [PATCH 6/8] Add changelog symlink --- web/CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) mode change 100644 => 120000 web/CHANGELOG.md diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md deleted file mode 100644 index effe43c82c..0000000000 --- a/web/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -## 1.0.0 - -- Initial version. diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md new file mode 120000 index 0000000000..04c99a55ca --- /dev/null +++ b/web/CHANGELOG.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file From de51ed6bd6857d2a4a0bc61381c1506679585e27 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 20 Jun 2024 00:37:43 +0200 Subject: [PATCH 7/8] Add dartdoc options symlink --- web/dartdoc_options.yaml | 1 + 1 file changed, 1 insertion(+) create mode 120000 web/dartdoc_options.yaml diff --git a/web/dartdoc_options.yaml b/web/dartdoc_options.yaml new file mode 120000 index 0000000000..7cbb8c0d74 --- /dev/null +++ b/web/dartdoc_options.yaml @@ -0,0 +1 @@ +../dart/dartdoc_options.yaml \ No newline at end of file From 5c0480b07bed952cd67c4ef59c9d144e9a962c48 Mon Sep 17 00:00:00 2001 From: GIancarlo Buenaflor Date: Thu, 20 Jun 2024 00:40:05 +0200 Subject: [PATCH 8/8] Run dart formatting --- .../enricher/enricher_event_processor.dart | 4 ++-- .../enricher/web_enricher_event_processor.dart | 11 +++++------ dart/lib/src/sentry.dart | 1 - dart/lib/src/sentry_options.dart | 4 +++- dart/lib/src/web/http_window.dart | 8 ++++---- dart/lib/src/web/noop_window.dart | 2 -- dart/lib/src/web/window.dart | 1 - flutter/example/lib/main.dart | 1 - flutter/lib/src/native/factory_real.dart | 2 +- web/lib/src/noop_window.dart | 1 - web/lib/src/sentry_web_base.dart | 3 +-- web/lib/src/web_window.dart | 6 +++--- 12 files changed, 19 insertions(+), 25 deletions(-) diff --git a/dart/lib/src/event_processor/enricher/enricher_event_processor.dart b/dart/lib/src/event_processor/enricher/enricher_event_processor.dart index 0fa0f0d8dd..e8b4390153 100644 --- a/dart/lib/src/event_processor/enricher/enricher_event_processor.dart +++ b/dart/lib/src/event_processor/enricher/enricher_event_processor.dart @@ -1,8 +1,8 @@ import '../../event_processor.dart'; import '../../sentry_options.dart'; import 'io_enricher_event_processor.dart' - if (dart.library.html) 'web_enricher_event_processor.dart' - if (dart.library.js_interop) 'web_enricher_event_processor.dart'; + if (dart.library.html) 'web_enricher_event_processor.dart' + if (dart.library.js_interop) 'web_enricher_event_processor.dart'; abstract class EnricherEventProcessor implements EventProcessor { factory EnricherEventProcessor(SentryOptions options) => diff --git a/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart b/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart index 8c0fdb2090..3b697f1f86 100644 --- a/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart +++ b/dart/lib/src/event_processor/enricher/web_enricher_event_processor.dart @@ -2,8 +2,8 @@ import '../../../sentry.dart'; import 'enricher_event_processor.dart'; import '../../web/noop_window.dart' - if (dart.library.html) '../../web/http_window.dart' - if (dart.library.js_interop) '../../web/web_window.dart'; + if (dart.library.html) '../../web/http_window.dart' + if (dart.library.js_interop) '../../web/web_window.dart'; EnricherEventProcessor enricherEventProcessor(SentryOptions options) { return WebEnricherEventProcessor( @@ -61,12 +61,11 @@ class WebEnricherEventProcessor implements EnricherEventProcessor { online: device?.online ?? _window.navigator.onLine, memorySize: device?.memorySize ?? _getMemorySize(), orientation: device?.orientation ?? _getScreenOrientation(), - screenHeightPixels: device?.screenHeightPixels ?? - _window.screen.availableHeight, + screenHeightPixels: + device?.screenHeightPixels ?? _window.screen.availableHeight, screenWidthPixels: device?.screenWidthPixels ?? _window.screen.availableWidth, - screenDensity: - device?.screenDensity ?? _window.devicePixelRatio, + screenDensity: device?.screenDensity ?? _window.devicePixelRatio, ); } diff --git a/dart/lib/src/sentry.dart b/dart/lib/src/sentry.dart index 361f301994..49f44f42ad 100644 --- a/dart/lib/src/sentry.dart +++ b/dart/lib/src/sentry.dart @@ -74,7 +74,6 @@ class Sentry { } static Future _initDefaultValues(SentryOptions options) async { - // Throws when running on the browser if (!options.platformChecker.isWeb) { // catch any errors that may occur within the entry function, main() diff --git a/dart/lib/src/sentry_options.dart b/dart/lib/src/sentry_options.dart index 34183468c5..fc86bdbc36 100644 --- a/dart/lib/src/sentry_options.dart +++ b/dart/lib/src/sentry_options.dart @@ -443,7 +443,9 @@ class SentryOptions { /// ``` Spotlight spotlight = Spotlight(enabled: false); - Window? Function() window = () { return null; }; + Window? Function() window = () { + return null; + }; SentryOptions({this.dsn, PlatformChecker? checker}) { if (checker != null) { diff --git a/dart/lib/src/web/http_window.dart b/dart/lib/src/web/http_window.dart index 5ceefa3b3c..0d3f483e17 100644 --- a/dart/lib/src/web/http_window.dart +++ b/dart/lib/src/web/http_window.dart @@ -41,11 +41,11 @@ class HttpWindowScreen implements WindowScreen { _window.screen?.orientation?.type == "portrait" ? ScreenOrientation.portrait : _window.screen?.orientation?.type == "landscape" - ? ScreenOrientation.landscape - : null; + ? ScreenOrientation.landscape + : null; } -class HttpWindowNavigator implements WindowNavigator { +class HttpWindowNavigator implements WindowNavigator { HttpWindowNavigator(this._window); final html.Window _window; @@ -67,4 +67,4 @@ class HttpWindowLocation implements WindowLocation { @override String? get pathname => _window.location.pathname; -} \ No newline at end of file +} diff --git a/dart/lib/src/web/noop_window.dart b/dart/lib/src/web/noop_window.dart index 946f47b075..7d2e6251e8 100644 --- a/dart/lib/src/web/noop_window.dart +++ b/dart/lib/src/web/noop_window.dart @@ -1,4 +1,3 @@ - import '../sentry_options.dart'; import 'window.dart'; @@ -7,7 +6,6 @@ Window createWindow(SentryOptions options) { } class NoopWindow implements Window { - @override WindowScreen get screen => NoopWindowScreen(); diff --git a/dart/lib/src/web/window.dart b/dart/lib/src/web/window.dart index e055a36e83..116a50df6d 100644 --- a/dart/lib/src/web/window.dart +++ b/dart/lib/src/web/window.dart @@ -1,5 +1,4 @@ abstract class Window { - WindowScreen get screen; WindowNavigator get navigator; WindowLocation get location; diff --git a/flutter/example/lib/main.dart b/flutter/example/lib/main.dart index 0f875003a1..90ca2d434f 100644 --- a/flutter/example/lib/main.dart +++ b/flutter/example/lib/main.dart @@ -45,7 +45,6 @@ var _isIntegrationTest = false; final GlobalKey navigatorKey = GlobalKey(); Future main() async { - await setupSentry( () => runApp( SentryWidget( diff --git a/flutter/lib/src/native/factory_real.dart b/flutter/lib/src/native/factory_real.dart index 6ffc6e57e3..d5d6870386 100644 --- a/flutter/lib/src/native/factory_real.dart +++ b/flutter/lib/src/native/factory_real.dart @@ -6,7 +6,7 @@ import 'sentry_native_binding.dart'; import 'sentry_native_channel.dart'; import 'cocoa/sentry_native_cocoa.dart' - if (dart.library.js_interop) 'cocoa/noop_sentry_native_cocoa.dart'; + if (dart.library.js_interop) 'cocoa/noop_sentry_native_cocoa.dart'; // import 'cocoa/noop_sentry_native_cocoa.dart' // if (dart.library.ffi) 'cocoa/sentry_native_cocoa.dart'; diff --git a/web/lib/src/noop_window.dart b/web/lib/src/noop_window.dart index 206dbbc005..2d18f2dafe 100644 --- a/web/lib/src/noop_window.dart +++ b/web/lib/src/noop_window.dart @@ -5,7 +5,6 @@ Window createWebWindow() { } class NoopWindow implements Window { - @override WindowScreen get screen => NoopScreen(); diff --git a/web/lib/src/sentry_web_base.dart b/web/lib/src/sentry_web_base.dart index 56f2a46bf1..e52bcdb895 100644 --- a/web/lib/src/sentry_web_base.dart +++ b/web/lib/src/sentry_web_base.dart @@ -1,7 +1,6 @@ import 'package:sentry/sentry.dart'; -import 'noop_window.dart' - if (dart.library.js_interop) 'web_window.dart'; +import 'noop_window.dart' if (dart.library.js_interop) 'web_window.dart'; class SentryWeb { static Window createWindow() { diff --git a/web/lib/src/web_window.dart b/web/lib/src/web_window.dart index 0ee8840447..61bb084c6d 100644 --- a/web/lib/src/web_window.dart +++ b/web/lib/src/web_window.dart @@ -39,11 +39,11 @@ class WebScreen implements WindowScreen { _window.screen.orientation.type == "portrait" ? ScreenOrientation.portrait : _window.screen.orientation.type == "landscape" - ? ScreenOrientation.landscape - : null; + ? ScreenOrientation.landscape + : null; } -class WebWindowNavigator implements WindowNavigator { +class WebWindowNavigator implements WindowNavigator { WebWindowNavigator(this._window); final web.Window _window;