amap_map_fluttify/example/lib/utils/next_latlng.dart

26 lines
570 B
Dart
Raw Normal View History

2024-11-17 15:45:43 +08:00
import 'dart:math';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
mixin NextLatLng {
final random = Random();
LatLng getNextLatLng({ LatLng? center}) {
center ??= LatLng(39.90960, 116.397228);
return LatLng(
center.latitude + random.nextDouble(),
center.longitude + random.nextDouble(),
);
}
List<LatLng> getNextBatchLatLng(int count) {
return [
for (int i = 0; i < count; i++)
LatLng(
39.90960 + random.nextDouble() * 4,
116.397228 + random.nextDouble() * 4,
)
];
}
}