AndreHaueisen / flushbar

Custom widget for Flutter
Other
1.01k stars 172 forks source link

Exception thrown when using with GoogleMap #161

Open takinok opened 4 years ago

takinok commented 4 years ago

Describe the bug When showing FlushBar and using 2 fingers on the Google Map(Especially rotate action), then the app throws an exception. After this exception is thrown once, it also gets thrown when using any other gesture (one or two fingers). It's may coursed by Flutter or Google Map. But, when using SnackBar, Exception is not thrown.

Device: Galaxy S20 5G OS: Android 10 Baseband: SCG01KDU1ATI1 Kernel: 4.19.81-19596063 (Same exception doesn't happened on iPhone SE and 6S when I take same action/gesture)

Logs ``` E/flutter ( 8075): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Null check operator used on a null value E/flutter ( 8075): #0 _AndroidMotionEventConverter.toAndroidMotionEvent (package:flutter/src/services/platform_views.dart:596:31) E/flutter ( 8075): #1 AndroidViewController.dispatchPointerEvent (package:flutter/src/services/platform_views.dart:864:31) E/flutter ( 8075): E/flutter ( 8075): #2 _PlatformViewGestureRecognizer.handleEvent (package:flutter/src/rendering/platform_view.dart:535:26) E/flutter ( 8075): #3 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:77:12) E/flutter ( 8075): #4 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:122:9) E/flutter ( 8075): #5 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:377:8) E/flutter ( 8075): #6 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18) E/flutter ( 8075): #7 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7) E/flutter ( 8075): #8 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:358:19) E/flutter ( 8075): #9 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338:22) E/flutter ( 8075): #10 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267:11) E/flutter ( 8075): #11 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295:7) E/flutter ( 8075): #12 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240:7) E/flutter ( 8075): #13 _rootRun (dart:async/zone.dart:1182:47) E/flutter ( 8075): #14 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter ( 8075): #15 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter ( 8075): #16 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter ( 8075): #17 _rootRun (dart:async/zone.dart:1190:13) E/flutter ( 8075): #18 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter ( 8075): #19 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter ( 8075): #20 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter ( 8075): #21 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) E/flutter ( 8075): #22 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) ```

Paste relevant code

Code ```dart import 'dart:async'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:flushbar/flushbar.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Snackbar/Flushbar Demo', theme: ThemeData( primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: MyHomePage(title: 'Snackbar/Flushbar Demo'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Map(), ); } } class Map extends StatefulWidget { @override _MapState createState() => _MapState(); } class _MapState extends State { Completer _mapController = Completer(); @override Widget build(BuildContext context) { return Container( child: Column( children: [ Expanded( child: GoogleMap( onMapCreated: (GoogleMapController controller) { _mapController.complete(controller); }, initialCameraPosition: CameraPosition( target: LatLng(35.65809922, 139.74135747), zoom: 15.0, ), ), ), Container( height: 50, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ RaisedButton( onPressed: () { final snackBar = SnackBar( content: Text('お知らせ!'), duration: Duration(seconds: 3), ); Scaffold.of(context).showSnackBar(snackBar); }, child: Text('SnackBar'), ), SizedBox(width: 50,), RaisedButton( onPressed: () { new Flushbar( title: 'TITLE', message: 'Test Message', duration: Duration(seconds: 3), )..show(context); }, child: Text('FlushBar')), ], ), ), ], ), ); } } ```

Flutter doctor

D:\github\sample_gmap>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.18362.1139], locale ja-JP)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.50.1)
[√] Connected device (1 available)