Skip to content

Commit 6d23889

Browse files
authored
Use maybeOf instead of try/catch block (#3088)
1 parent 86943da commit 6d23889

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

flutter/lib/src/screenshot/sentry_screenshot_widget.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,7 @@ class _SentryScreenshotWidgetState extends State<SentryScreenshotWidget> {
123123
}
124124

125125
// Detect the current text direction or fall back to LTR
126-
TextDirection textDirection;
127-
try {
128-
textDirection = Directionality.of(context);
129-
} catch (_) {
130-
textDirection = TextDirection.ltr;
131-
}
126+
final textDirection = Directionality.maybeOf(context) ?? TextDirection.ltr;
132127

133128
return RepaintBoundary(
134129
child: Directionality(

0 commit comments

Comments
 (0)