I'm having a little bit of trouble with Google Map widget.
In short, I have 3 pages, home page with bottom navigation bar, map page - basic stateful widget with GoogleMap in Scaffold body, and another page. Everytime I switch from map page too fast I'm getting this error and whole app freezes.
E/BufferQueueProducer( 9243): [SurfaceTexture-0-9243-14] dequeueBuffer: BufferQueue has been abandoned
To my understanding it boils down to the fact that map keep loading after SurfaceTexture destruction, like here: https://stackoverflow.com/a/22490648/11318016
I see there are ways to solve it on android, but I didn't find a way to handle it in flutter.
I had the same problem and I fixed it adding "with AutomaticKeepAliveClientMixin" to my statefulwidget. It'll make your widget never die and save you from the exception about present too much frames. This: E/BufferQueueProducer( 9243): [SurfaceTexture-0-9243-14] dequeueBuffer: BufferQueue has been abandoned
will be still in debug terminal but it's not an error.
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class GoThereView extends StatefulWidget {
@override
_GoThereViewState createState() => _GoThereViewState();
}
class _GoThereViewState extends State<GoThereView> with AutomaticKeepAliveClientMixin {
GoogleMapController _controller;
@override
bool get wantKeepAlive => true;
void _onMapCreated(GoogleMapController controller) {
if( _controller == null )
_controller = controller;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Stack(
children: <Widget>[
GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(target: LatLng(26.8206, 30.8025)),
)
],
),
);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With