| 12345678910111213141516171819202122232425262728 |
- import 'package:flutter/material.dart';
- import 'package:dio/dio.dart';
- import '../showAlert.dart';
- bool isNotError(BuildContext context,json){
- print('-----------${json}----------');
- if(json is DioError){
- alertError(context, json.toString());
- return false;
- }else if( json.data['success']&& json.data['code']==1){
- return true;
- }else{
- alertError(context, json.data['msg']);
- return false;
- }
- }
- alertError(BuildContext context,String str){
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: str, childCallback: (val) {
-
- },
- );
- });
- }
|