2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Flutter】'initialCameraPosition != null' : is not true.が起こった時の解決策

Posted at

#なりゆき
以下のページを参照しながらコピペをしていると途中で画像のエラーが起きた。
Google公式Flutter用Google Mapsプラグインを一通り使ってみた

image.png

#解決方法
initialCameraPositionがnullということなのでカメラの初期座標を設定する。

lib/main.dart
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        height: MediaQuery.of(context).size.height,
        width: MediaQuery.of(context).size.width,
        child: GoogleMap(
          onMapCreated: _onMapCreated,
          //以下に座標を追記
          initialCameraPosition: CameraPosition(
            target: LatLng(35.692558, 139.699530),
          ),
        ),
      ),
    );
  }

#結果

最低限表示はされた。
image.png

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?