https://github.com/jonashackt/google_maps_in_flutter
Implementing https://codelabs.developers.google.com/codelabs/google-maps-in-flutter#0
https://github.com/jonashackt/google_maps_in_flutter
Last synced: 10 months ago
JSON representation
Implementing https://codelabs.developers.google.com/codelabs/google-maps-in-flutter#0
- Host: GitHub
- URL: https://github.com/jonashackt/google_maps_in_flutter
- Owner: jonashackt
- Created: 2022-05-12T10:02:27.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-12T14:10:02.000Z (about 4 years ago)
- Last Synced: 2025-04-07T11:47:16.397Z (about 1 year ago)
- Language: C++
- Size: 119 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# google_maps_in_flutter
[](https://github.com/jonashackt/google_maps_in_flutter/actions)
[](https://github.com/jonashackt/how-to-flutter/blob/master/LICENSE)
[](https://renovatebot.com)
Just doing the codelab https://codelabs.developers.google.com/codelabs/google-maps-in-flutter#3
For me my flutter SDK complains about the code in https://codelabs.developers.google.com/codelabs/google-maps-in-flutter#3
`type 'MyApp' is not a subtype of type 'StatelessWidget' in type cast`:
```
======== Exception caught by widgets library =======================================================
The following _CastError was thrown building MyApp(dirty):
type 'MyApp' is not a subtype of type 'StatelessWidget' in type cast
When the exception was thrown, this was the stack:
#0 StatelessElement.widget (package:flutter/src/widgets/framework.dart:4824:46)
#1 StatelessElement.build (package:flutter/src/widgets/framework.dart:4827:21)
#2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4754:15)
#3 Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
#4 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2659:19)
#5 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#6 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#7 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#8 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1081:9)
#9 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:862:7)
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)
====================================================================================================
```
so I rebuild the code to:
```dart
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Maps Sample App',
theme: ThemeData(
appBarTheme: const AppBarTheme(backgroundColor: Colors.green)),
home: const MapsView(),
);
}
}
class MapsView extends StatefulWidget {
const MapsView({Key? key}) : super(key: key);
@override
State createState() => _MapsViewState();
}
class _MapsViewState extends State {
late GoogleMapController mapController;
final LatLng _center = const LatLng(45.521563, -122.677433);
void _onMapCreated(GoogleMapController controller) {
mapController = controller;
}
@override
Widget build(BuildContext context) {
return GoogleMap(
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _center,
zoom: 11.0,
),
);
}
}
```