title: How to Change the map view to new marker location in Flutter_map
body: <p>I'm using Flutter_map package and MapBox API for my app, I'm able to locate the current user location in the map but I want to put a button on the map and change the View of it to a new position when the user clicks on it (new location predefined as a marker 'secondPosition' in my code),
  by the way, I know how to do it in the Google Maps package but I have no idea how to do it in flutter_map.</p>
  <pre><code>import 'dart:async';
  import 'package:flutter/material.dart';
  import 'package:flutter_map/flutter_map.dart';
  import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
  import 'package:fluttertoast/fluttertoast.dart';
  import 'package:geolocator/geolocator.dart';
  import 'package:latlong2/latlong.dart' as latLng;
  
  void main() {
    runApp(const MyApp());
  }
  
  class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);
  
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Flutter Demo',
  
        home: const MyHomePage(title: 'Flutter Demo Home Page'),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
    const MyHomePage({Key? key, required this.title}) : super(key: key);
  
  
    final String title;
  
    @override
    State&lt;MyHomePage&gt; createState() =&gt; _MyHomePageState();
  }
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    String  currentPosition = 'my Position';
    latLng.LatLng school = latLng.LatLng(37.2560129, 49.5855304);
  
    late CenterOnLocationUpdate _centerOnLocationUpdate;
    late StreamController&lt;double?&gt; _centerCurrentLocationStreamController;
  
    @override
    void initState() {
      super.initState();
      _determinePosition();
      _centerOnLocationUpdate = CenterOnLocationUpdate.always;
      _centerCurrentLocationStreamController = StreamController&lt;double?&gt;();
    }
  
    @override
    void dispose() {
      _centerCurrentLocationStreamController.close();
      super.dispose();
    }
  
  
  
    _determinePosition() async {
      bool serviceEnabled;
      LocationPermission permission;
  
      serviceEnabled = await Geolocator.isLocationServiceEnabled();
      if (!serviceEnabled) {
        Fluttertoast.showToast(msg: 'Please enable Your Location Service');
      }
  
      permission = await Geolocator.checkPermission();
      if (permission == LocationPermission.denied) {
        permission = await Geolocator.requestPermission();
        if (permission == LocationPermission.denied) {
          Fluttertoast.showToast(msg: 'Location permissions are denied');
        }
      }
  
      if (permission == LocationPermission.deniedForever) {
        Fluttertoast.showToast(
            msg:
            'Location permissions are permanently denied, we cannot request permissions.');
      }
  
      Position position = await Geolocator.getCurrentPosition(
          desiredAccuracy: LocationAccuracy.high);
  
      setState(() {
  
        currentPosition =
        &quot; lat=${position.latitude} long=${position.longitude}&quot;;
  
      });
  
      Fluttertoast.showToast(msg: '$currentPosition ');
    }
  
  
    @override
    Widget build(BuildContext context) {
      Marker SecondPosition = Marker(
        anchorPos: AnchorPos.align(AnchorAlign.top),
  
        width: 80.0,
        height: 80.0,
        point:  school,
        builder: (ctx) =&gt;
            Icon(Icons.location_on_outlined,size: 30,color: Colors.red,),
      );
  
  
      return Scaffold(
        appBar: AppBar(
  
          title: Text(widget.title),
        ),
        body: Container(
          child: FlutterMap(
            options: MapOptions(
  
              center: school,
              zoom: 17,
              onPositionChanged: (MapPosition position, bool hasGesture) {
                if (hasGesture) {
                  setState(
                        () =&gt; _centerOnLocationUpdate = CenterOnLocationUpdate.never,
                  );
                }
              },
            ),
            children: [
              TileLayerWidget(options: TileLayerOptions(
                  urlTemplate:
                  &quot;https://api.mapbox.com/styles/v1/badsina/cl10kxiip004y16sxae7s7uyo/tiles/256/{z}/{x}/{y}@2x?access_token=pk.&quot;
                      &quot;eyJ1IjoiYmFkc2luYSIsImEiOiJjbDEwa2p2b3oxemc3M2JrYm9jZ3d0eHFvIn0.j5mmEFjIz41ZF3ATSXEVAg&quot;,
                  additionalOptions: {
                    'accessToken':
                    'pk.eyJ1IjoiYmFkc2luYSIsImEiOiJjbDEwa2p2b3oxemc3M2JrYm9jZ3d0eHFvIn0.j5mmEFjIz41ZF3ATSXEVAg',
                    'id': 'mapbox.mapbox-streets-v8'
                  }),),
  
              LocationMarkerLayerWidget(
  
                plugin: LocationMarkerPlugin(
                  centerCurrentLocationStream:
                  _centerCurrentLocationStreamController.stream,
                ),
              ),
            ],
            nonRotatedChildren: [
              Positioned(
                right: 20,
                bottom: 20,
                child: FloatingActionButton(
                  onPressed: () {
                    // Automatically center the location marker on the map when location updated until user interact with the map.
                    setState(
                          () =&gt; _centerOnLocationUpdate = CenterOnLocationUpdate.always,
                    );
                    // Center the location marker on the map and zoom the map to level 18.
                    _centerCurrentLocationStreamController.add(18);
                  },
                  child: const Icon(
                    Icons.my_location,
                    color: Colors.white,
                  ),
                ),
              )
            ],
          ),
        ),
      );
    }
  }
  
  </code></pre>