lint: code lint

This commit is contained in:
Kuloud
2024-08-26 00:00:23 +08:00
parent 8c59ec203a
commit 43ecfb8ca1
10 changed files with 39 additions and 31 deletions

View File

@ -10,7 +10,7 @@
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
part of amap_map;
part of '../amap_map.dart';
final MethodChannelAMapFlutterMap _methodChannel =
AMapFlutterPlatform.instance as MethodChannelAMapFlutterMap;
@ -30,7 +30,7 @@ class AMapController {
static Future<AMapController> init(
int id,
CameraPosition initialCameration,
_MapState mapState,
mapState,
) async {
await _methodChannel.init(id);
return AMapController._(

View File

@ -305,9 +305,9 @@ class _MapState extends State<AMapWidget> {
_markers = keyByMarkerId(widget.markers);
if (widget.infoWindowAdapter != null) {
_markers.values.forEach((marker) {
for (var marker in _markers.values) {
_onInfoWindowUpdate(marker);
});
}
}
}

View File

@ -23,6 +23,7 @@ import 'package:stream_transform/stream_transform.dart';
import 'map_event.dart';
// ignore: constant_identifier_names
const VIEW_TYPE = 'com.amap.flutter.map';
/// 使用[MethodChannel]与Native代码通信的[AMapFlutterPlatform]的实现。

View File

@ -234,9 +234,6 @@ class Marker extends BaseOverlay {
zIndex == typedOther.zIndex;
}
@override
int get hashCode => super.hashCode;
@override
String toString() {
return 'Marker{id: $id, alpha: $alpha, anchor: $anchor, '
@ -244,6 +241,11 @@ class Marker extends BaseOverlay {
'icon: $icon, infoWindowEnable: $infoWindowEnable, infoWindow: $infoWindow, position: $position, rotation: $rotation, '
'visible: $visible, zIndex: $zIndex, onTap: $onTap}';
}
@override
int get hashCode => Object.hashAll([
id,
]);
}
Map<String, Marker> keyByMarkerId(Iterable<Marker> markers) {

View File

@ -16,10 +16,10 @@ class MarkerUpdates {
return currentMarkers[id]!;
}
final Set<String> _markerIdsToRemove =
final Set<String> tempMarkerIdsToRemove =
prevMarkerIds.difference(currentMarkerIds);
final Set<Marker> _markersToAdd = currentMarkerIds
final Set<Marker> tempMarkersToAdd = currentMarkerIds
.difference(prevMarkerIds)
.map(idToCurrentMarker)
.toSet();
@ -29,15 +29,15 @@ class MarkerUpdates {
return current != previous;
}
final Set<Marker> _markersToChange = currentMarkerIds
final Set<Marker> tempMarkersToChange = currentMarkerIds
.intersection(prevMarkerIds)
.map(idToCurrentMarker)
.where(hasChanged)
.toSet();
markersToAdd = _markersToAdd;
markerIdsToRemove = _markerIdsToRemove;
markersToChange = _markersToChange;
markersToAdd = tempMarkersToAdd;
markerIdsToRemove = tempMarkerIdsToRemove;
markersToChange = tempMarkersToChange;
}
/// 想要添加的marker集合.

View File

@ -18,8 +18,8 @@ class Polygon extends BaseOverlay {
this.fillColor = const Color(0xC487CEFA),
this.visible = true,
this.joinType = JoinType.bevel})
: assert(points.length > 0),
this.strokeWidth = (strokeWidth <= 0 ? 10 : strokeWidth),
: assert(points.isNotEmpty),
strokeWidth = (strokeWidth <= 0 ? 10 : strokeWidth),
super();
/// 覆盖物的坐标点数组,不能为空
@ -100,7 +100,9 @@ class Polygon extends BaseOverlay {
}
@override
int get hashCode => super.hashCode;
int get hashCode => Object.hashAll([
id,
]);
dynamic _pointsToJson() {
final List<dynamic> result = <dynamic>[];

View File

@ -184,6 +184,11 @@ class Polyline extends BaseOverlay {
}
return result;
}
@override
int get hashCode => Object.hashAll([
id,
]);
}
Map<String, Polyline> keyByPolylineId(Iterable<Polyline> polylines) {