2025-08-12 13:36:42 +08:00
|
|
|
import 'dart:convert';
|
2025-09-30 14:48:12 +08:00
|
|
|
import 'package:ai_chat_core/ai_chat_core.dart';
|
2025-09-24 15:42:30 +08:00
|
|
|
import 'package:t_basic_intl/intl.dart';
|
2025-08-12 13:36:42 +08:00
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
|
|
|
|
|
|
class LocationService {
|
|
|
|
|
String lang = Intl.getCurrentLocale().startsWith('zh') ? 'zh' : 'en';
|
|
|
|
|
Future<String> search(double lon, double lat) async {
|
|
|
|
|
try {
|
|
|
|
|
final uri = Uri.parse(
|
|
|
|
|
'http://143.64.185.20:18606/location_info?lon=${lon}&lat=${lat}&lang=${lang}');
|
|
|
|
|
final response = await http.get(uri);
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return json.decode(response.body)['address'];
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
2025-09-30 14:48:12 +08:00
|
|
|
Logger.e('Error during text classification: $e');
|
2025-08-12 13:36:42 +08:00
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|