Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter unhandled exception

import 'dart:async';
import 'package:flutter/material.dart';

void main() =>
  runZoned<Future<void>>(
    () async {
      runApp(MyApp());
    },
    onError: (dynamic error, StackTrace stackTrace) {
      print("=================== CAUGHT DART ERROR");
      // Send report
      // NEVER REACHES HERE - WHY?
    },
  );

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();

    // This captures errors reported by the FLUTTER framework.
    FlutterError.onError = (FlutterErrorDetails details) {
      print("=================== CAUGHT FLUTTER ERROR");
      // Send report
      // NEVER REACHES HERE - WHY?
    };
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: RaisedButton(
            child: Text("Throw exception"),
            onPressed: () {
              throw Exception("This is a test exception");
            },
          ),
        ),
      ),
    );
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: how to create space between list on flutter 
Dart :: what is late in dart 
Dart :: ~/ vs / dart 
Dart :: how to run dart code in vscode 
Dart :: select an item woth index list dart 
Dart :: How to i convert this python code to dart? 
Dart :: is init state executed when returning with navigator flutter 
Dart :: flutter radial gradient with alignment 
Dart :: flutter navigator get result 
Dart :: create extention in dart 
Dart :: dart data structures 
Dart :: flutter sqflite foreign keyy 
Dart :: Get Prime Number in dart 
Dart :: print $ symbol in dart 
Dart :: flutter list key value 
Dart :: dart map what is 
Dart :: customscrollview add container widget 
Swift :: add shadow to uibutton swift 
Swift :: get length of array swift 
Swift :: how to disable uitableview selection in swift 
Swift :: swift get current time 
Swift :: swift check dictionary has key 
Swift :: convert data to json swift 
Swift :: swift remove all duplicates from an array 
Swift :: pop last element array swift 
Swift :: swift enum 
Swift :: string to json swift 
Swift :: swift calendar components 
Swift :: set white place holder color in swift 
Swift :: swift remove value dictionary 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =