add
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
|
import 'dart:developer'; // 引入日志工具
|
||||||
|
|
||||||
// 国家数据模型
|
// 国家数据模型
|
||||||
class Country {
|
class Country {
|
||||||
@@ -71,6 +72,8 @@ class _CountryHomePageState extends State<CountryHomePage> {
|
|||||||
_showErrorDialog('获取失败', response.data['message'] ?? '未知错误');
|
_showErrorDialog('获取失败', response.data['message'] ?? '未知错误');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// 添加网络异常日志
|
||||||
|
log('获取国家列表网络异常', error: e, stackTrace: StackTrace.current);
|
||||||
_showErrorDialog('网络错误', e.toString());
|
_showErrorDialog('网络错误', e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -112,6 +115,8 @@ class _CountryHomePageState extends State<CountryHomePage> {
|
|||||||
_showErrorDialog('创建失败', response.data['message'] ?? '未知错误');
|
_showErrorDialog('创建失败', response.data['message'] ?? '未知错误');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// 添加网络异常日志
|
||||||
|
log('创建国家网络异常', error: e, stackTrace: StackTrace.current);
|
||||||
_showErrorDialog('网络错误', e.toString());
|
_showErrorDialog('网络错误', e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -141,6 +146,8 @@ class _CountryHomePageState extends State<CountryHomePage> {
|
|||||||
_showErrorDialog('更新失败', response.data['message'] ?? '未知错误');
|
_showErrorDialog('更新失败', response.data['message'] ?? '未知错误');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// 添加网络异常日志
|
||||||
|
log('更新国家网络异常', error: e, stackTrace: StackTrace.current);
|
||||||
_showErrorDialog('网络错误', e.toString());
|
_showErrorDialog('网络错误', e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -174,6 +181,8 @@ class _CountryHomePageState extends State<CountryHomePage> {
|
|||||||
_showErrorDialog('删除失败', response.data['message'] ?? '未知错误');
|
_showErrorDialog('删除失败', response.data['message'] ?? '未知错误');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// 添加网络异常日志
|
||||||
|
log('删除国家网络异常', error: e, stackTrace: StackTrace.current);
|
||||||
_showErrorDialog('网络错误', e.toString());
|
_showErrorDialog('网络错误', e.toString());
|
||||||
} finally {
|
} finally {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
Reference in New Issue
Block a user