Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.43 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. import 'package:flutter/services.dart';
  4.  
  5. class TestSentryScreen extends StatelessWidget {
  6.   @override
  7.   Widget build(BuildContext context) {
  8.     return new Scaffold(
  9.         body: new Center(
  10.           child: new Column(
  11.             mainAxisAlignment: MainAxisAlignment.center,
  12.             children: <Widget>[
  13.               new RaisedButton(
  14.                 child: new Text('Dart exception'),
  15.                 elevation: 1.0,
  16.                 onPressed: () {
  17.                   throw new StateError('This is a Dart exception.');
  18.                 },
  19.               ),
  20.               new RaisedButton(
  21.                 child: new Text('async Dart exception'),
  22.                 elevation: 1.0,
  23.                 onPressed: () async {
  24.                   foo() async {
  25.                     throw new StateError('This is an async Dart exception.');
  26.                   }
  27.                   bar() async {
  28.                     await foo();
  29.                   }
  30.                   await bar();
  31.                 },
  32.               ),
  33.               new RaisedButton(
  34.                 child: new Text('Java exception'),
  35.                 elevation: 1.0,
  36.                 onPressed: () async {
  37.                   final channel = const MethodChannel('crashy-custom-channel');
  38.                   await channel.invokeMethod('blah');
  39.                 },
  40.               ),
  41.             ],
  42.           ),
  43.         ),
  44.     );
  45.   }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement