Add flutter_map and OpenStreetMap dependencies
epic-geographic-peer-mentor-map-data-infrastructure-task-009 — Add flutter_map and latlong2 packages to pubspec.yaml. Configure the OpenStreetMap tile URL template, attribution string, and fallback tile error handler. Verify the package versions are compatible with the existing Flutter SDK version and that OSM tile usage complies with the OSM tile usage policy for the expected request volume.
Acceptance Criteria
Technical Requirements
Implementation Notes
Add to pubspec.yaml under dependencies: flutter_map: ^6.1.0 (verify latest at pub.dev/packages/flutter_map) and latlong2: ^0.9.0. The latlong2 version must match the one flutter_map depends on — check flutter_map's own pubspec.yaml if you get a version conflict. Create lib/features/map/config/map_config.dart with static constants: kOsmTileUrlTemplate, kOsmAttribution, kDefaultMapCenter (e.g. Oslo coordinates: LatLng(59.9139, 10.7522)), kDefaultZoom (10.0).
The OSM usage policy (https://operations.openstreetmap.org/policies/tiles) requires: valid HTTP User-Agent header, attribution displayed, caching enabled, no bulk downloading. Configure the TileLayer userAgentPackageName parameter with your app's package name (e.g. 'no.norskdigital.likepersonsapp') to comply. If the app is expected to scale beyond a few hundred daily active users, evaluate tile.openstreetmap.org versus a self-hosted tile server or commercial provider (Mapbox, Maptiler) — document this decision in the epic.
Testing Requirements
Smoke test: create a minimal MapScreen widget with FlutterMap + TileLayer pointing to OSM and verify tiles load in a Flutter integration test or manual device test. Verify flutter pub get produces no version conflicts by checking the pubspec.lock. Run flutter analyze to confirm no new lint errors from the added packages. Test on both iOS simulator and Android emulator to confirm the network request to OSM tile endpoint succeeds (check with Flutter DevTools network tab).
Test the errorTileCallback fires correctly by pointing the tile URL to an invalid endpoint in a test environment.
Supabase's hosted PostGIS extension behaviour may differ from the local emulator for spatial RPC functions, causing bounding-box queries to return incorrect results or fail in production while passing locally.
Mitigation & Contingency
Mitigation: Write integration tests against the Supabase emulator from the start and run the same test suite against a staging Supabase project before merging. Use ST_DWithin and ST_MakeEnvelope in plain SQL first, validate with psql, then wrap as RPC.
Contingency: If PostGIS RPC proves unreliable, fall back to client-side bounding box filtering on a full fetch of consented mentor locations (acceptable for up to ~200 mentors per chapter) until the spatial query is stabilised.
OpenStreetMap tile usage may require attribution handling and rate limiting. Switching to Google Maps Flutter plugin mid-implementation would require significant rework of the map-provider-integration abstraction.
Mitigation & Contingency
Mitigation: Define the map-provider-integration abstraction interface before selecting the SDK so that the concrete implementation is swappable. Implement OSM first with correct attribution. Document Google Maps as the alternate with its API key setup steps.
Contingency: If OSM tiles are rejected by stakeholders or tile server limits are hit, activate the Google Maps Flutter plugin implementation behind the same interface without touching any UI or service code.
Incorrect RLS configuration could allow a coordinator to query mentor locations from a different organisation, constituting a GDPR data breach.
Mitigation & Contingency
Mitigation: Write dedicated RLS integration tests with two isolated test organisations and assert that cross-organisation queries return zero rows. Include these tests in CI. Have a second developer review all RLS policy SQL before migration is applied.
Contingency: If a cross-organisation data leak is discovered post-deployment, immediately disable the map feature via the organisation feature flag, revoke the affected Supabase RLS policy, and notify the data protection officer per the organisation's GDPR incident response procedure.