Repository: flutter
Issue: FlutterErrorDetail return null on release mode
Labels: framework,a: release,has reproducible steps,P2,found in release: 2.1,team-framework,triaged-framework

I'm using this code to catch errors in my flutter application and it works perfectly in debug mode but in release mode FlutterErrorDetails is null and I cant see what caused the error.

This is the code that I use:
```
runZonedGuarded(() {
    WidgetsFlutterBinding.ensureInitialized();
   
    FlutterError.onError = (FlutterErrorDetails details) {
        MyApp.sendBug(details);
        MyApp.bugSentTime = DateTime.now();
    };

    runApp(MyApp());
  }, (error, stackTrace) {
      FlutterErrorDetails details = FlutterErrorDetails(exception: error, stack: stackTrace);
      MyApp.sendBug(details);
      MyApp.bugSentTime = DateTime.now();
    FirebaseCrashlytics.instance.recordError(error, stackTrace);
  });
```


Steps to Reproduce
Create any flutter UI bug 


Expected results:
```
2020 01:47:40 GMT+0100 (Central European Standard Time) {
       mode: 'debug',
       os: 'android',
       model: 'SM-N770F',
       brand: 'samsung',
       osVersion: '29',
       buildNumber: '1',
       buildVersion: '1.0.0',
       username: 'Emad',
       error: '══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞═════════════════\n' +
         'The following assertion was thrown resolving an image codec:\n' +
         'Unable to load asset: assets/images/1.png\n' +
         'When the exception was thrown, this was the stack:\n' +
         .....
}
```

Actual results:

```
2020 17:00:40 GMT+0100 (Central European Standard Time) {
       mode: 'release',
       os: 'android',
       model: 'SM-N770F',
       brand: 'samsung',
       osVersion: '29',
       buildNumber: '1',
       buildVersion: '1.0.0',
       username: 'Emad',
       error: ''
}
```

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue.
-->

```
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
```


```
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.2 20D80 darwin-x64, locale en-US)
    • Flutter version 1.22.6 at /Users/emad/flutter
    • Framework revision 9b2d32b605 (7 weeks ago), 2021-01-22 14:36:39 -0800
    • Engine revision 2f0af37152
    • Dart version 2.10.5

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/emad/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.2, Build version 12B45b
    • CocoaPods version 1.9.3

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.
```