Aboubacar Sawadogo
Aboubacar Sawadogo

Reputation: 1

offline map integration difficulties

I am stuck loading the card. I've tried Mbtile files without success, PNG images too.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Offline Map')),
      drawer: buildDrawer(context, route),
      body: Padding(
        padding: const EdgeInsets.all(8),
        child: Column(
          children: [
            const Padding(
              padding: EdgeInsets.only(top: 8, bottom: 8),
              child: Text(
                  'This is an offline map that is showing Anholt Island, Denmark.'),
            ),
            Flexible(
              child: FlutterMap(
                options: MapOptions(
                  initialCenter: const LatLng(56.704173, 11.543808),
                  minZoom: 12,
                  maxZoom: 14,
                  cameraConstraint: CameraConstraint.containCenter(
                    bounds: LatLngBounds(
                      const LatLng(56.7378, 11.6644),
                      const LatLng(56.6877, 11.5089),
                    ),
                  ),
                ),
                children: [
                  TileLayer(
                    
                    tileProvider: AssetTileProvider(),
                    maxZoom: 14,
                    urlTemplate: 'assets/map/anholt_osmbright/{z}/{x}/{y}.png',
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Error:

error : flutter: Unable to load asset: "assets/map/anholt_osmbright/12/2046/1361.png".
flutt
flutter: Unable to load asset: "assets/map/anholt_osmbright/12/2047/1360.png".
flutter: Exception: Asset not found
flutter: Unable to load asset: "assets/map/anholt_osmbright/12/2045/1363.png".
flutter: Exception: Asset not found
flutter: Unable to load asset: "assets/map/anholt_osmbright/12/2047/1363.png".
flutter: Exception: Asset not found`

Upvotes: 0

Views: 171

Answers (0)

Related Questions