Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
QM_TJ
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
QM_TJ
Commits
949d5b4d
Commit
949d5b4d
authored
Feb 17, 2021
by
李增强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加设备类型和网络类型
parent
9b962889
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
2 deletions
+57
-2
lib/src/utils.dart
lib/src/utils.dart
+16
-2
pubspec.lock
pubspec.lock
+40
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/src/utils.dart
View file @
949d5b4d
...
...
@@ -2,9 +2,11 @@ import 'dart:convert';
import
'http.dart'
;
import
'package:crypto/crypto.dart'
as
crypto
;
import
'package:package_info/package_info.dart'
;
import
'package:connectivity/connectivity.dart'
;
class
Utils
{
static
String
channel
=
''
;
static
String
deviceId
=
''
;
static
bool
isDebug
=
false
;
static
Http
_http
=
Http
(
scheme:
"http"
,
host:
"8.135.58.206"
,
port:
8802
);
...
...
@@ -40,12 +42,24 @@ class Utils {
// 获取网络类型
static
Future
<
String
>
getNetworkType
()
async
{
return
"4G"
;
var
result
=
await
Connectivity
().
checkConnectivity
();
var
type
=
'none'
;
if
(
result
==
ConnectivityResult
.
mobile
)
{
type
=
'mobile'
;
}
else
if
(
result
==
ConnectivityResult
.
wifi
)
{
type
=
'wifi'
;
}
return
type
;
}
// 设置设备ID
static
void
setDeviceId
(
String
d
)
{
deviceId
=
d
;
}
// 获取设备ID
static
Future
<
String
>
getDeviceId
()
async
{
return
"3A26610FFE43D5838DDE7A40BA2E3E2C"
;
return
deviceId
;
}
// 获取公共参数
...
...
pubspec.lock
View file @
949d5b4d
...
...
@@ -43,6 +43,34 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0-nullsafety.3"
connectivity:
dependency: "direct dev"
description:
name: connectivity
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.2"
connectivity_for_web:
dependency: transitive
description:
name: connectivity_for_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.1+4"
connectivity_macos:
dependency: transitive
description:
name: connectivity_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.0+7"
connectivity_platform_interface:
dependency: transitive
description:
name: connectivity_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.6"
convert:
dependency: transitive
description:
...
...
@@ -74,6 +102,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
matcher:
dependency: transitive
description:
...
...
@@ -102,6 +135,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
sky_engine:
dependency: transitive
description: flutter
...
...
pubspec.yaml
View file @
949d5b4d
...
...
@@ -19,6 +19,7 @@ dependencies:
dev_dependencies
:
flutter_test
:
sdk
:
flutter
connectivity
:
^2.0.2
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment