fetchMakerInfoByLatLng function

Future<MakerInfo> fetchMakerInfoByLatLng(
  1. Client client,
  2. LatLng latLng
)

Implementation

Future<MakerInfo> fetchMakerInfoByLatLng(http.Client client, LatLng latLng) async {

  final response = await client
       .get(Uri.parse('https://mapi.darkvn.net/searchbytext?address='+latLng.latitude.toString()+','+latLng.longitude.toString()));
      print('Routing Coords:${Uri.parse('https://mapi.darkvn.net/searchbytext?address='+latLng.latitude.toString()+','+latLng.longitude.toString())}');

      var data = jsonDecode(response.body);
      Random random = new Random();

      return MakerInfo(
      type: 'spoint',
      id: random.nextInt(100000000),
      lat: data[0]['lat'] as double,
      lng: data[0]['lng'] as double,
      name: data[0]['title'] as String,
      address: data[0]['address'] as String,
      phone: '',
      img: '',
      fax: '',
      email: '',
      routingInfo: null,
    );

}