title: Can not switch to another page
body: <p>Here is two classes, that I use, and I want to go from home.dart to map.dart</p>
  
  <p>I need to be working that FlatButton, where onPressed is MapPage();</p>
  
  <p>I also tried to add MaterialApp, because anything I have seen is done with that, but I didn't understood how and what is wrong with all of that. StreaProvider I need for the Firebase, so I can't remove this. </p>
  
  <p>Please, help, if you know how. I really need just to switch to a new page</p>
  
  <p>home.dart </p>
  
  <pre><code>import 'dart:ui';
  import 'package:flutter/material.dart';
  import 'package:notifier_app/models/locationCoordinates.dart';
  import 'package:notifier_app/screens/map_page/map.dart';
  import 'package:notifier_app/services/auth.dart';
  import 'package:notifier_app/services/database.dart';
  import 'package:provider/provider.dart';
  import 'package:notifier_app/screens/home/coordinates_list.dart';
  
  class Home extends StatelessWidget {
    final AuthService _auth = AuthService();
    /*final MapPage _mapPage = MapPage();*/
  
    @override
    Widget build(BuildContext context) {
      return Stack(
        children: &lt;Widget&gt;[
          Image.asset(
            "assets/homeBackGround.jpg",
            height: MediaQuery.of(context).size.height,
            width: MediaQuery.of(context).size.width,
            fit: BoxFit.cover,
          ),
            StreamProvider&lt;List&lt;LocationCoordinates&gt;&gt;.value(
              value: DatabaseService().coordinatesOfGPS,
              child: Scaffold(
                backgroundColor: Colors.transparent,
                appBar: AppBar(
                  title: Text('Notifier'),
                  backgroundColor: Colors.transparent,
                  elevation: 0.0,
                  actions: &lt;Widget&gt;[
                    FlatButton.icon(
                      icon: Icon(Icons.map),
                      label: Text('Map'),
                      textColor: Colors.black54,
                      onPressed: () {
                        MapPage();
                        },
                    ),
                    FlatButton.icon(
                      icon: Icon(Icons.person),
                      label: Text('Logout'),
                      textColor: Colors.black54,
                      onPressed: () async {
                        await _auth.signOut();
                      },
                    ),
                  ],
                ),
                body: CoordinatesList(),
              ),
            ),
        ],
      );
    }
  }
  </code></pre>
  
  <p>map.dart</p>
  
  <pre><code>import 'dart:async';
  
  import 'package:google_maps_flutter/google_maps_flutter.dart';
  import 'package:flutter/material.dart';
  
  class MapPage extends StatefulWidget {
    @override
    _MapPageState createState() =&gt; _MapPageState();
  }
  
  class _MapPageState extends State&lt;MapPage&gt; {
  
    Completer&lt;GoogleMapController&gt; _controller = Completer();
    static const LatLng _center = const LatLng(45.5231563, -122.677433);
    final Set&lt;Marker&gt; _markers = {};
    LatLng _lastMapPosition = _center;
    MapType _currentMapType = MapType.normal;
  
    static final CameraPosition _position1 = CameraPosition(
      bearing: 192.833,
      target: LatLng(45.531563, -122.677433),
      tilt: 59.440,
      zoom: 11.0,
    );
  
    Future&lt;void&gt; _goToPosition1() async {
      final GoogleMapController controller = await _controller.future;
      controller.animateCamera(CameraUpdate.newCameraPosition(_position1));
    }
  
    _onMapCreated(GoogleMapController controller){
      _controller.complete(controller);
    }
  
    _onCameraMove(CameraPosition position){
      _lastMapPosition = position.target;
    }
  
    _onMapTypeButtonPressed() {
      _currentMapType =
          _currentMapType == MapType.normal ? MapType.satellite : MapType.normal;
    }
  
    _onAddMarkerButtonPressed() {
      setState(() {
        _markers.add(Marker(
          markerId: MarkerId(_lastMapPosition.toString()),
          position: _lastMapPosition,
          infoWindow: InfoWindow(
            title: 'This is a Title',
            snippet: 'This is a snippet',
          ),
          icon: BitmapDescriptor.defaultMarker,
        ));
      });
    }
  
    Widget button(Function function, IconData icon){
      return FloatingActionButton(
        onPressed: function,
        materialTapTargetSize: MaterialTapTargetSize.padded,
        backgroundColor: Colors.blue,
        child: Icon(
          icon,
          size: 36.0,
        ),
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: Text('Google Map'),
            backgroundColor: Colors.blue,
          ),
          body: Stack(
            children: &lt;Widget&gt;[
              GoogleMap(
                onMapCreated: _onMapCreated,
                initialCameraPosition: CameraPosition(
                  target: _center,
                  zoom:11.0,
                ),
                mapType: _currentMapType,
                markers: _markers,
                onCameraMove: _onCameraMove,
              ),
              Padding(
                padding: EdgeInsets.all(16.0),
                child: Align(
                  alignment: Alignment.topRight,
                  child: Column(
                    children: &lt;Widget&gt;[
                      button(_onMapTypeButtonPressed, Icons.map),
                      SizedBox(
                        height: 16.0,
                      ),
                      button(_onAddMarkerButtonPressed, Icons.add_location),
                      SizedBox(
                        height: 16.0,
                      ),
                      button(_goToPosition1, Icons.location_searching),
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
      );
    }
  }
  </code></pre>