Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
execute flutter format . on sentry-flutter
  • Loading branch information
fzyzcjy committed Mar 6, 2021
commit 85b76b0eb37f246f4393787dee09b6be6c7e104e
14 changes: 10 additions & 4 deletions flutter/lib/src/widgets_binding_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,16 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
return;
}
final brightness = WidgetsBinding.instance?.window.platformBrightness;
final brightnessDescription = brightness == Brightness.dark ? 'dark' : 'light';
final brightnessDescription =
brightness == Brightness.dark ? 'dark' : 'light';

_hub.addBreadcrumb(Breadcrumb(
message: 'Platform brightness was changed to $brightnessDescription.',
type: 'system',
category: 'device.event',
data: <String, String>{'action': 'BRIGHTNESS_CHANGED_TO_${brightnessDescription.toUpperCase()}'},
data: <String, String>{
'action': 'BRIGHTNESS_CHANGED_TO_${brightnessDescription.toUpperCase()}'
},
));
}

Expand All @@ -106,7 +109,9 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
message: 'Text scale factor changed to $newTextScaleFactor.',
type: 'system',
category: 'device.event',
data: <String, String>{'action': 'TEXT_SCALE_CHANGED_TO_$newTextScaleFactor'},
data: <String, String>{
'action': 'TEXT_SCALE_CHANGED_TO_$newTextScaleFactor'
},
));
}

Expand All @@ -121,7 +126,8 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
// - https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/
// - https://github.com/getsentry/sentry-java/blob/main/sentry-android-core/src/main/java/io/sentry/android/core/AppComponentsBreadcrumbsIntegration.java#L98-L135
// on why this breadcrumb looks like this.
const message = 'App had memory pressure. This indicates that the operating system '
const message =
'App had memory pressure. This indicates that the operating system '
'would like applications to release caches to free up more memory.';
_hub.addBreadcrumb(Breadcrumb(
message: message,
Expand Down
3 changes: 2 additions & 1 deletion flutter/test/default_integrations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ void main() {
FlutterError.onError =
handler ?? (FlutterErrorDetails errorDetails) async {};

when(fixture.hub.captureEvent(captureAny)).thenAnswer((_) => Future.value(SentryId.empty()));
when(fixture.hub.captureEvent(captureAny))
.thenAnswer((_) => Future.value(SentryId.empty()));

FlutterErrorIntegration()(fixture.hub, fixture.options);

Expand Down
9 changes: 6 additions & 3 deletions flutter/test/load_contexts_integrations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ void main() {
expect(options.eventProcessors.length, 1);

final e = SentryEvent();
final event = await (options.eventProcessors.first(e) as FutureOr<SentryEvent>);
final event =
await (options.eventProcessors.first(e) as FutureOr<SentryEvent>);

expect(called, true);
expect(event.contexts.device!.name, 'Device1');
Expand Down Expand Up @@ -83,7 +84,8 @@ void main() {
runtimes: [const SentryRuntime(name: 'eRT')])
..['theme'] = 'cuppertino';
final e = SentryEvent(contexts: eventContexts);
final event = await (options.eventProcessors.first(e) as FutureOr<SentryEvent>);
final event =
await (options.eventProcessors.first(e) as FutureOr<SentryEvent>);

expect(called, true);
expect(event.contexts.device!.name, 'eDevice');
Expand Down Expand Up @@ -113,7 +115,8 @@ void main() {
packages: const [SentryPackage('event-package', '2.0')],
);
final e = SentryEvent(sdk: eventSdk);
final event = await (options.eventProcessors.first(e) as FutureOr<SentryEvent>);
final event =
await (options.eventProcessors.first(e) as FutureOr<SentryEvent>);

expect(
event.sdk!.packages.any((element) => element.name == 'native-package'),
Expand Down
6 changes: 4 additions & 2 deletions flutter/test/sentry_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ void main() {
verify(transport.send(captureAny)).captured.first as SentryEvent;

expect(event.sdk!.integrations.length, 6);
expect(event.sdk!.integrations.contains('loadContextsIntegration'), false);
expect(
event.sdk!.integrations.contains('loadContextsIntegration'), false);
});

test('should not add loadAndroidImageListIntegration if not Android',
Expand All @@ -116,7 +117,8 @@ void main() {
verify(transport.send(captureAny)).captured.first as SentryEvent;

expect(event.sdk!.integrations.length, 6);
expect(event.sdk!.integrations.contains('loadAndroidImageListIntegration'),
expect(
event.sdk!.integrations.contains('loadAndroidImageListIntegration'),
false);
});
});
Expand Down
3 changes: 2 additions & 1 deletion flutter/test/widgets_binding_observer_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ void main() {

window.onTextScaleFactorChanged!();

final newTextScaleFactor = WidgetsBinding.instance!.window.textScaleFactor;
final newTextScaleFactor =
WidgetsBinding.instance!.window.textScaleFactor;

final breadcrumb =
verify(hub.addBreadcrumb(captureAny)).captured.single as Breadcrumb;
Expand Down