Flutter Google maps dequeueBuffer:BufferQueue已被放弃
我在使用谷歌地图小部件时遇到了一些问题。Flutter Google maps dequeueBuffer:BufferQueue已被放弃,flutter,dart,Flutter,Dart,我在使用谷歌地图小部件时遇到了一些问题。 简言之,我有3个页面,带有底部导航栏的主页,在脚手架主体中带有GoogleMap的地图页面-基本状态小部件,以及另一个页面。每次我从地图页面切换得太快,我都会遇到这个错误,整个应用程序都会冻结 E/BufferQueueProducer(9243):[SurfaceTexture-0-9243-14]出列缓冲区:已放弃BufferQueue 据我所知,这归结为这样一个事实,即在SurfacetTexture被破坏后,map会继续加载,如下所示: 我知道有
简言之,我有3个页面,带有底部导航栏的主页,在脚手架主体中带有GoogleMap的地图页面-基本状态小部件,以及另一个页面。每次我从地图页面切换得太快,我都会遇到这个错误,整个应用程序都会冻结
E/BufferQueueProducer(9243):[SurfaceTexture-0-9243-14]出列缓冲区:已放弃BufferQueue
据我所知,这归结为这样一个事实,即在SurfacetTexture被破坏后,map会继续加载,如下所示:我知道有很多方法可以在android上解决这个问题,但我没有找到一种方法来处理颤振。错误是由API密钥格式错误引起的。确保您的API密钥正确。我也遇到了同样的问题,我在statefulwidget中添加了“with automatickepaliveclientmixin”来修复它。它将使您的小部件永不消亡,并将您从显示太多帧的异常中拯救出来。此:
E/BufferQueueProducer(9243):[SurfaceTexture-0-9243-14]出列缓冲区:BufferQueue已被放弃
仍将在调试终端中,但这不是错误
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)),
)
],
),
);
}
}
导入“包装:颤振/材料.省道”;
导入“包:google_-maps_-flatter/google_-maps_-flatter.dart”;
类GoThereView扩展了StatefulWidget{
@凌驾
_GoThereViewState createState()=>\u GoThereViewState();
}
类_GoThereViewState使用AutomaticEpaLiveClientMixin扩展状态{
GoogleMapController\u控制器;
@凌驾
bool get wantKeepAlive=>true;
void\u onMapCreated(谷歌地图控制器){
如果(_controller==null)
_控制器=控制器;
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(),
主体:堆栈(
儿童:[
谷歌地图(
onMapCreated:_onMapCreated,
初始CameraPosition:CameraPosition(目标:LatLng(26.8206,30.8025)),
)
],
),
);
}
}