fluttify-project / amap_location_fluttify

高德地图 定位组件 Flutter插件
Other
105 stars 39 forks source link

dispose方法,tag报错 #81

Closed Yxjie closed 3 years ago

Yxjie commented 4 years ago

插件版本 0.13.1 报错日志 The following NoSuchMethodError was thrown: I/flutter ( 6259): Class 'com_amap_api_location_AMapLocationClient' has no instance getter 'tag'. I/flutter ( 6259): Receiver: Instance of 'com_amap_api_location_AMapLocationClient' I/flutter ( 6259): Tried calling: tag I/flutter ( 6259): I/flutter ( 6259): When the exception was thrown, this was the stack: I/flutter ( 6259): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5) I/flutter ( 6259): #1 AmapLocation.dispose. (package:amap_location_fluttify/src/facade/amap_location.dart:435:40) I/flutter ( 6259): #2 WhereIterator.moveNext (dart:_internal/iterable.dart:442:13) I/flutter ( 6259): #3 MappedIterator.moveNext (dart:_internal/iterable.dart:394:19) I/flutter ( 6259): #4 new List.from (dart:core-patch/array_patch.dart:47:19) I/flutter ( 6259): #5 Iterable.toList (dart:core/iterable.dart:400:12) I/flutter ( 6259): #6 Ref_Batch.release_batch (package:foundation_fluttify/src/type/core/ref.dart:92:43)

对应代码

 final isCurrentPlugin = (it) => it.tag == 'amap_location_fluttify';
    await kNativeObjectPool.where(isCurrentPlugin).release_batch();
    kNativeObjectPool.removeWhere(isCurrentPlugin);

Debug日志

kNativeObjectPool = {_CompactLinkedHashSet} {com_amap_api_location_AMapLocationClient{refId: 73744499}, com_amap_api_location_AMapLocationClientOption{refId: 147419343}, co
 _index = {_Uint32List} size = 16
 _hashMask = 536870911
 _data = {_List} size = 8
  0 = {com_amap_api_location_AMapLocationClient} com_amap_api_location_AMapLocationClient{refId: 73744499}
  1 = {com_amap_api_location_AMapLocationClientOption} com_amap_api_location_AMapLocationClientOption{refId: 147419343}
  2 = {com_amap_api_location_AMapLocation} com_amap_api_location_AMapLocation{refId: 246512023}
  3 = null
  4 = null
  5 = null
  6 = null
  7 = null
 _usedData = 3
 _deletedKeys = 0

kNativeObjectPool的字典里面,添加了为null对象,导致闭包方法it.tag 报错

k3v1n-uncle commented 4 years ago

me too

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.