init method

dynamic init()

Implementation

init() async {
  //   List<LatLng> coordinates=[];
  //   coordinates = Markers.map((e) => LatLng(e.Positions!.lat, e.Positions!.lng)).toList();
  //  if(Fences!=null){
  //    coordinates.addAll( Fences!
  //       .whereType<PolygonRF>()
  //       .map((p) =>
  //             LatLng(p.Points.first.lat, p.Points.first.lng,)).toList());

  //         coordinates .addAll( Fences!
  //       .whereType<CircleRF>()
  //       .map((p) =>
  //             LatLng(p.Points.lat, p.Points.lng,)).toList());

  //  }
  print(Markers);
  print(Fences);

  _options = MapOptions(
      initialCameraFit: Markers.isEmpty
          ? null
          : CameraFit.coordinates(
              coordinates: Markers.map(
                  (e) => LatLng(e.Positions!.lat, e.Positions!.lng)).toList(),
              maxZoom: 16,
              // minZoom: 14,
              padding: Markers[0].padding != null
                  ? Markers[0].padding!
                  : const EdgeInsets.only(
                      left: 25, right: 25, top: 10, bottom: 10),
            ),
      backgroundColor: Colors.grey,
      initialCenter: _currentLocation(),
      initialZoom: _initialZoom(),
      interactionOptions: const InteractionOptions(
        flags: InteractiveFlag.all & ~InteractiveFlag.rotate,
      ),
      onPointerCancel: (event, point) {
        debugPrint("onPointerCancel");
      },
      onPointerDown: (event, point) {
        // debugPrint("onPointerDown");
      },
      onPointerUp: (event, LatLng point) => OnPointerUp == null
          ? null
          : OnPointerUp!(point.latitude, point.longitude),
      onMapEvent: (mapEvent) {
        // debugPrint(p0.camera.center.latitude);
        // debugPrint("onMapEvent");
      },
      onPositionChanged: (MapCamera camera, bool hasGesture) {
        // debugPrint(
        //     "onPositionChanged::${camera.center.latitude}::${camera.zoom}");
        camera.rotation;
        if (OnScroll != null) {
          OnScroll!(
              camera.center.latitude, camera.center.longitude, camera.zoom);
        }
      },
      onMapReady: () => OnMapCreated == null ? null : OnMapCreated!(),
      onTap: (tapPosition, point) =>
          OnTap == null ? null : OnTap!(point.latitude, point.longitude));
}