custom action error

Hi, anybody has an idea what this error is for?

Launching lib/main.dart on Web Server in debug mode...

Waiting for connection from debug service on Web Server...

lib/custom_code/actions/filter_nearby_users.dart:11:1: Error: 'LatLng' is imported from both 'package:insavior/flutter_flow/lat_lng.dart' and 'package:latlong2/latlong.dart'.

import 'package:geodesy/geodesy.dart';

^^^^^^

lib/custom_code/actions/filter_nearby_users.dart:46:25: Error: The argument type 'Query<Map<String, dynamic>>' can't be assigned to the parameter type 'DocumentReference<Object?>'.

- 'Query' is from 'package:cloud_firestore/cloud_firestore.dart' ('/home/.pub-cache/hosted/pub.dev/cloud_firestore-4.8.0/lib/cloud_firestore.dart').

- 'Map' is from 'dart:core'.

- 'DocumentReference' is from 'package:cloud_firestore/cloud_firestore.dart' ('/home/.pub-cache/hosted/pub.dev/cloud_firestore-4.8.0/lib/cloud_firestore.dart').

- 'Object' is from 'dart:core'.

nearbyUsers.add(userDoc);

the code:

// DO NOT REMOVE OR MODIFY THE CODE ABOVE! import 'package:geodesy/geodesy.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; Future<List<DocumentReference>> filterNearbyUsers( LatLng? myLocation, List<LatLng>? othersLocation, ) async { // Initialize Geodesy object final geodesy = Geodesy(); // Define search radius in meters final searchRadius = 5000.0; // Create a list to store nearby users final nearbyUsers = <DocumentReference>[]; // Check if myLocation and othersLocation are not null if (myLocation != null && othersLocation != null) { // Loop through othersLocation list for (final location in othersLocation) { // Calculate distance final distance = geodesy.distanceBetweenTwoGeoPoints(myLocation, location); // Check if distance is within search radius if (distance <= searchRadius) { // Get reference to user document in admin collection final userDoc = FirebaseFirestore.instance .collection('admin') .where('location', isEqualTo: GeoPoint(location.latitude, location.longitude)) .limit(1); // Add user document reference to nearbyUsers list nearbyUsers.add(userDoc); } } } // Return nearbyUsers list return nearbyUsers;

Thank youu
1
4 replies