1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import 'package:flutter/services.dart';
// flutter 埋点方案
class PhobosFlutter {
static const MethodChannel _channel =
const MethodChannel('phobos_flutter_plugin');
///
/// track
/// 灰度信息
///
/// @param GreyType 事件名.
///
/// 使用示例:
/// PhobosFlutter.getGreyType();
///
static Future<String> get getGreyType async {
return await _channel.invokeMethod('getGreyType');
}
///当前API
static Future<String> get getServerAPI async {
return await _channel.invokeMethod('getServerAPI');
}
/// signingType 包的类型
static Future<String> get getSigningType async {
return await _channel.invokeMethod('getServerAPI');
}
/// userId
static Future<String> get getUserId async {
return await _channel.invokeMethod('getUserId');
}
///
/// track
/// 事件追踪
///
/// @param eventName String 事件名.
/// @param properties Map<String,dynamic> 事件属性.
///
/// 使用示例:
/// PhobosFlutter.track('eventname',{'key1':'value1','key2':'value2'});
///
static void track(String eventName ,Map<String, dynamic> properties ) {
assert(eventName != null);
List<dynamic> params = [eventName,properties];
_channel.invokeMethod('track',params);
}
static void trackSendNow(String eventName ,Map<String, dynamic> properties ) {
assert(eventName != null);
List<dynamic> params = [eventName,properties];
_channel.invokeMethod('track',params);
}
}