当前位置:网站首页>Flutter judges network availability
Flutter judges network availability
2022-04-22 08:30:00 【GuoXuan_ CHN】
Flutter Judge network availability
Dependency package
dependencies:
connectivity: ^0.4.2
Code
import 'package:connectivity/connectivity.dart';
///2019.4.18 By GX
/// Determine if the network is available
///0 - none | 1 - mobile | 2 - WIFI
Future<int> isNetWorkAvailable() async{
var connectivityResult = await (new Connectivity().checkConnectivity());
if (connectivityResult == ConnectivityResult.mobile)
return 1;
else if (connectivityResult == ConnectivityResult.wifi)
return 2;
else if (connectivityResult == ConnectivityResult.none)
return 0;
}
appreciate
If it helps you , Stand by me , Thank you for

版权声明
本文为[GuoXuan_ CHN]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220735463483.html
边栏推荐
猜你喜欢

【论文阅读】【3d目标检测】Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds

The starting point of the final end of the 15th day of the sprint to the big factory

58 Technology Salon issue 28 - anjuke quality assurance system Salon

oh-my-notepro

MySQL in-depth study (3-2): other database tuning strategies

js学习笔记

The collection palette in LabVIEW 2012 is imported into LabVIEW 2013

BLDC双闭环(速度PI+电流PI)simulink仿真模型

nacos基础(3):OPEN API配置管理测试与关闭nacos服务

每日一题冲刺大厂第十五天 终于结束的起点
随机推荐
STM32对舵机SG90的PWM输出
Typescript学习指南
GoWeb基础
shell脚本中ps -ef查询进程PID一直返回异常
3-1 比较大小
Flutter Modul类与Json相互转换
js再学习
CAS: 36530-06-0 boron chloride phthalocyanine | phthalocyanine | boron chloride phthalocyanine | dichloroboron phthalocyanine dye | boron chloride phthalocyanine | boronsubphalocyaninichloride
Amino (- NH2) phthalocyanine copper CAS: 28632-30-6 (tetraaminophthalocyanine) copper (II) tetraaminophthalocyanine copper (cutapc) - shared by Qiyue biological editor
GAVL021,GAVL281,AC220V转5V200MA小体积非隔离芯片方案
SQL requirements processing - count the number of Mondays to Sundays in a given year
Under the new retail development trend, how to operate and promote the social e-commerce platform?
ospf四类,五类和七类LSA详解
每日一题冲刺大厂第十五天提高组 模
Flutter GridView Demo
Cr doped strontium titanate Cr: SrTiO3 crystal substrate | NaCl < 111 > 10x10x2 0mm1sp crystal substrate | Al2O3 sapphire crystal substrate | Qiyue biology
LeetCode_ 118. Yanghui triangle_ Dynamic programming_ Int * * learning
Experiment 4: Data Preprocessing
oracle数据库表空间容量查询及扩容
liunx基础—zabbix5.0监控系统安装部署