- 
                Notifications
    
You must be signed in to change notification settings  - Fork 170
 
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Platforms
web
Version of flutter maplibre_gl
0.24.1
Bug Description
When using a MapLibre style that references sprites not included in its sprite sheet, the web implementation attempts to load these sprites as Flutter assets from localhost/assets/ instead of allowing MapLibre GL JS to handle them gracefully or load them from the style's sprite server.
Steps to Reproduce
- Create a new Flutter project with the code above
 - Add maplibre_gl: ^0.24.1 to pubspec.yaml
 - Ensure web/index.html includes MapLibre GL JS:
 
Expected Results
When a sprite is missing from the style's sprite sheet:
- MapLibre GL JS should handle it gracefully (either skip rendering or load from sprite server)
 - No exceptions should be thrown
 - No 404 errors to localhost
 
Actual Results
The web implementation intercepts missing sprite requests and attempts to load them as Flutter assets, causing:
- Multiple 404 errors: GET http://localhost:62059/assets/hairdresser_11 404 (Not Found)
 - Promise rejection exceptions: DartError: Unable to load asset: "hairdresser_11"
 - Console spam with errors for each missing sprite, and the debugger to pause on exceptions
 
Code Sample
import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('MapLibre Sprite Bug')),
        body: MapLibreMap(
          styleString: "https://tiles.stadiamaps.com/styles/outdoors.json?api_key=YOUR_KEY",
          initialCameraPosition: const CameraPosition(
            target: LatLng(51.5074, -0.1278),
            zoom: 13,
          ),
          onMapCreated: (_) {},
        ),
      ),
    );
  }
}skyracer2012
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

