1

When I run the code below I'm getting errors in that nature **A problem occurred evaluating project ':mapbox_gl'.

SDK Registry token is null. See README.md for more information.**

I believe setting mapbox access token as global or environment variable could solve the problem. If anyone can assist with respect to which files I need to create to store the key and how do I access the tokenenter image description here

class HomeScreen extends StatelessWidget {


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: FutureBuilder(
        future: loadConfigFile(),
        builder: (BuildContext buildContext,
            AsyncSnapshot<Map<String, dynamic>> snapshot) {
          if (snapshot.hasData) {
            return MapboxMap(
                accessToken: snapshot.data['mapbox_api_token'],
                initialCameraPosition: CameraPosition(
                    target: LatLng(-17.8075325, 30.9532117)));
          }
          else {

            return Center(
              child: CircularProgressIndicator(),
            )

          }
        },
      ),
    );
  }
}

An image illustrating the actual error if this can help make this question clear

Apealed
  • 1,415
  • 8
  • 29

1 Answers1

1

It says in package README. You need to create a private token and add it to gradle.properties.

Package: https://github.com/flutter-mapbox-gl/maps

MapBox instructions: https://docs.mapbox.com/android/maps/guides/install/

JoKr
  • 4,976
  • 8
  • 27
  • 39