Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Bugly Flutter Plugin
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
李增强
Bugly Flutter Plugin
Commits
6c98be4e
Commit
6c98be4e
authored
Jun 08, 2021
by
rockypzhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update readme
parent
4d2ea01a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
130 deletions
+99
-130
README.md
README.md
+4
-0
lib/bugly.dart
lib/bugly.dart
+72
-105
lib/buglyLog.dart
lib/buglyLog.dart
+22
-24
pubspec.yaml
pubspec.yaml
+1
-1
No files found.
README.md
View file @
6c98be4e
...
...
@@ -7,3 +7,7 @@ this plugin is developed base on bugly native crash sdk.
Android Native Sdk Doc: https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20181014122344
iOS Crash Native Sdk Doc: https://bugly.qq.com/docs/user-guide/instruction-manual-ios/?v=20181014122344
pub dev : https://pub.dev/packages/bugly_crash/
lib/bugly.dart
View file @
6c98be4e
...
...
@@ -2,196 +2,163 @@ import 'dart:async';
import
'dart:io'
;
import
'package:flutter/services.dart'
;
/**
* Description:bugly futter plugin .
* @author rockypzhang
* @since 2019/5/28
*/
/// Description:bugly futter plugin .
/// @author rockypzhang
/// @since 2019/5/28
class
Bugly
{
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'bugly'
);
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'bugly'
);
static
Future
<
String
>
get
platformVersion
async
{
final
String
version
=
await
_channel
.
invokeMethod
(
'getPlatformVersion'
);
return
version
;
}
/**
* 初始化接口.
* @param appId appId
* @param isDebug 是否打开debug开关
*/
/// 初始化接口.
/// @param appId appId
/// @param isDebug 是否打开debug开关
static
Future
<
void
>
initAndroidCrashReport
({
String
?
appId
,
bool
?
isDebug
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"appId"
:
appId
,
"isDebug"
:
isDebug
,
"isDebug"
:
isDebug
,
};
_channel
.
invokeMethod
(
"initCrashReport"
,
map
);
_channel
.
invokeMethod
(
"initCrashReport"
,
map
);
}
/**
* 自定义上报域名.
* @param url 自定义域名
*/
/// 自定义上报域名.
/// @param url 自定义域名
static
Future
<
void
>
setAndroidServerUrl
({
String
?
url
,
})
async
{
if
(
Platform
.
isAndroid
)
{
})
async
{
if
(
Platform
.
isAndroid
)
{
Map
<
String
,
Object
?>
map
=
{
"url"
:
url
,
};
_channel
.
invokeMethod
(
"setServerUrl"
,
map
);
_channel
.
invokeMethod
(
"setServerUrl"
,
map
);
}
}
/**
* 设置App渠道.
*
* @param appChannel App渠道
*/
/// 设置App渠道.
/// @param appChannel App渠道
static
Future
<
void
>
setAndroidAppChannel
({
String
?
appChannel
,
})
async
{
if
(
Platform
.
isAndroid
)
{
})
async
{
if
(
Platform
.
isAndroid
)
{
Map
<
String
,
Object
?>
map
=
{
"appChannel"
:
appChannel
,
"appChannel"
:
appChannel
,
};
_channel
.
invokeMethod
(
"setAppChannel"
,
map
);
_channel
.
invokeMethod
(
"setAppChannel"
,
map
);
}
}
/**
* 设置App包名
*
* @param appPackage App包名
*/
/// 设置App包名
/// @param appPackage App包名
static
Future
<
void
>
setAndroidAppPackage
({
String
?
appPackage
,
})
async
{
if
(
Platform
.
isAndroid
)
{
})
async
{
if
(
Platform
.
isAndroid
)
{
Map
<
String
,
Object
?>
map
=
{
"appPackage"
:
appPackage
,
"appPackage"
:
appPackage
,
};
_channel
.
invokeMethod
(
"setAppPackage"
,
map
);
_channel
.
invokeMethod
(
"setAppPackage"
,
map
);
}
}
/**
* 设置App 设备 id
*
* @param appPackage App包名
*/
/// 设置App 设备 id
/// @param appPackage App包名
static
Future
<
void
>
setAndroidDeviceId
({
String
?
deviceId
,
})
async
{
if
(
Platform
.
isAndroid
)
{
})
async
{
if
(
Platform
.
isAndroid
)
{
Map
<
String
,
Object
?>
map
=
{
"deviceId"
:
deviceId
,
"deviceId"
:
deviceId
,
};
_channel
.
invokeMethod
(
"setDeviceId"
,
map
);
_channel
.
invokeMethod
(
"setDeviceId"
,
map
);
}
}
/**
* 初始化接口.
* @param appId appId
*/
/// 初始化接口.
/// @param appId appId
static
Future
<
void
>
initIosCrashReport
({
String
?
appId
,
bool
?
debugMode
,
String
?
serverUrl
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"appId"
:
appId
,
"debugMode"
:
debugMode
,
"serverUrl"
:
serverUrl
};
_channel
.
invokeMethod
(
"initCrashReport"
,
map
);
_channel
.
invokeMethod
(
"initCrashReport"
,
map
);
}
/**
* 上报自定义异常.
*
* @param type 错误类型
* @param error 错误信息
* @param stackTrace 出错堆栈
* @param extraInfo 额外信息
*/
/// 上报自定义异常.
/// @param type 错误类型
/// @param error 错误信息
/// @param stackTrace 出错堆栈
/// @param extraInfo 额外信息
static
Future
<
void
>
postException
({
String
?
type
,
String
?
error
,
String
?
stackTrace
,
Map
<
String
,
String
>?
extraInfo
,
})
async
{
Map
<
String
,
String
>?
extraInfo
,
})
async
{
Map
<
String
,
Object
?>
map
=
{
"type"
:
type
,
"error"
:
error
,
"stackTrace"
:
stackTrace
,
"extraInfo"
:
extraInfo
,
"type"
:
type
,
"error"
:
error
,
"stackTrace"
:
stackTrace
,
"extraInfo"
:
extraInfo
,
};
_channel
.
invokeMethod
(
"postException"
,
map
);
_channel
.
invokeMethod
(
"postException"
,
map
);
}
/**
* 设置App版本
*
* @param appVersion App版本
*/
/// 设置App版本
/// @param appVersion App版本
static
Future
<
void
>
setAppVersion
({
String
?
appVersion
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"appVersion"
:
appVersion
,
"appVersion"
:
appVersion
,
};
_channel
.
invokeMethod
(
"setAppVersion"
,
map
);
_channel
.
invokeMethod
(
"setAppVersion"
,
map
);
}
/**
* 设置用户场景 ,可以在初始化前执行.
*
* @param userSceneTag 唯一标识一种场景,必须大于0
*/
/// 设置用户场景 ,可以在初始化前执行.
/// @param userSceneTag 唯一标识一种场景,必须大于0
static
Future
<
void
>
setUserSceneTag
({
int
?
userSceneTag
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"userSceneTag"
:
userSceneTag
,
"userSceneTag"
:
userSceneTag
,
};
_channel
.
invokeMethod
(
"setUserSceneTag"
,
map
);
_channel
.
invokeMethod
(
"setUserSceneTag"
,
map
);
}
/**
* 设置用户id
*
* @param userSceneTag 唯一标识一种场景,必须大于0
*/
/// 设置用户id
/// @param userSceneTag 唯一标识一种场景,必须大于0
static
Future
<
void
>
setUserId
({
String
?
userId
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"userId"
:
userId
,
"userId"
:
userId
,
};
_channel
.
invokeMethod
(
"setUserId"
,
map
);
_channel
.
invokeMethod
(
"setUserId"
,
map
);
}
/**
* 添加用户数据Key,Value.
*
* @param userKey 用户数据key
* @param userValue 用户数据value
*/
/// 添加用户数据Key,Value.
/// @param userKey 用户数据key
/// @param userValue 用户数据value
static
Future
<
void
>
putUserData
({
String
?
userKey
,
String
?
userValue
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"userKey"
:
userKey
,
"userValue"
:
userValue
,
"userKey"
:
userKey
,
"userValue"
:
userValue
,
};
_channel
.
invokeMethod
(
"putUserData"
,
map
);
_channel
.
invokeMethod
(
"putUserData"
,
map
);
}
}
lib/buglyLog.dart
View file @
6c98be4e
import
'dart:async'
;
import
'package:flutter/services.dart'
;
class
BuglyLog
{
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'bugly'
);
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'bugly'
);
static
Future
<
void
>
d
({
String
?
tag
,
String
?
content
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"tag"
:
tag
,
"content"
:
content
,
"tag"
:
tag
,
"content"
:
content
,
};
_channel
.
invokeMethod
(
"logd"
,
map
);
_channel
.
invokeMethod
(
"logd"
,
map
);
}
static
Future
<
void
>
i
({
String
?
tag
,
String
?
content
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"tag"
:
tag
,
"content"
:
content
,
"tag"
:
tag
,
"content"
:
content
,
};
_channel
.
invokeMethod
(
"logi"
,
map
);
_channel
.
invokeMethod
(
"logi"
,
map
);
}
static
Future
<
void
>
v
({
String
?
tag
,
String
?
content
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"tag"
:
tag
,
"content"
:
content
,
"tag"
:
tag
,
"content"
:
content
,
};
_channel
.
invokeMethod
(
"logv"
,
map
);
_channel
.
invokeMethod
(
"logv"
,
map
);
}
static
Future
<
void
>
w
({
String
?
tag
,
String
?
content
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"tag"
:
tag
,
"content"
:
content
,
"tag"
:
tag
,
"content"
:
content
,
};
_channel
.
invokeMethod
(
"logw"
,
map
);
_channel
.
invokeMethod
(
"logw"
,
map
);
}
static
Future
<
void
>
e
({
String
?
tag
,
String
?
content
,
})
async
{
})
async
{
Map
<
String
,
Object
?>
map
=
{
"tag"
:
tag
,
"content"
:
content
,
"tag"
:
tag
,
"content"
:
content
,
};
_channel
.
invokeMethod
(
"loge"
,
map
);
_channel
.
invokeMethod
(
"loge"
,
map
);
}
}
pubspec.yaml
View file @
6c98be4e
name
:
bugly_crash
description
:
Flutter app can use this plugin to monitor exception happened and upload error or crash to bugly server.
version
:
0.0.
3
version
:
0.0.
4
homepage
:
https://bugly.qq.com
environment
:
...
...
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