Skip to content

Commit 51e811a

Browse files
author
weiqiangliu
committed
Release 2.0.0
1 parent 030a7dc commit 51e811a

File tree

7 files changed

+20
-29
lines changed

7 files changed

+20
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.0
2+
3+
* 支持 null safety
4+
15
## 1.0.6
26

37
* 同步原生 SDK 接口

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
```yml
1818
dependencies:
1919
# 添加神策 flutter plugin
20-
sensors_analytics_flutter_plugin: ^1.0.6
20+
sensors_analytics_flutter_plugin: ^2.0.0
2121
```
2222
2323
执行 flutter packages get 命令安装插件

example/ios/Flutter/.last_build_id

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
40ab8879ed4b816959a627e9de50322e
1+
73a9b6c7109b0f6550f436eb1a242583

ios/sensors_analytics_flutter_plugin.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
Pod::Spec.new do |s|
55
s.name = 'sensors_analytics_flutter_plugin'
6-
s.version = '1.0.6'
6+
s.version = '2.0.0'
77
s.summary = 'A new flutter plugin project.'
88
s.description = <<-DESC
99
A new flutter plugin project.

lib/sensors_analytics_flutter_plugin.dart

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ class SensorsAnalyticsFlutterPlugin {
2222
/// 使用示例:
2323
/// SensorsAnalyticsFlutterPlugin.track('eventname',{'key1':'value1','key2':'value2'});
2424
///
25-
static void track(String eventName, Map<String, dynamic> properties) {
26-
assert(eventName != null);
25+
static void track(String eventName, Map<String, dynamic>? properties) {
2726
_convertDateTime(properties);
2827
List<dynamic> params = [eventName, properties];
2928
_channel.invokeMethod('track', params);
@@ -40,8 +39,7 @@ class SensorsAnalyticsFlutterPlugin {
4039
/// SensorsAnalyticsFlutterPlugin.trackInstallation('AppInstall',{'key1':'value1','key2':'value2'});
4140
///
4241
static void trackInstallation(String eventName,
43-
Map<String, dynamic> properties) {
44-
assert(eventName != null);
42+
Map<String, dynamic>? properties) {
4543
_convertDateTime(properties);
4644
List<dynamic> params = [eventName, properties];
4745
_channel.invokeMethod('trackInstallation', params);
@@ -52,7 +50,6 @@ class SensorsAnalyticsFlutterPlugin {
5250
/// @param eventName 事件的名称
5351
/// @return 交叉计时的事件名称
5452
static Future<String> trackTimerStart(String eventName) async {
55-
assert(eventName != null);
5653
List<String> params = [eventName];
5754
return await _channel.invokeMethod('trackTimerStart', params);
5855
}
@@ -61,7 +58,6 @@ class SensorsAnalyticsFlutterPlugin {
6158
///
6259
/// [eventName] 事件的名称
6360
static void trackTimerPause(String eventName) {
64-
assert(eventName != null);
6561
List<String> params = [eventName];
6662
_channel.invokeMethod('trackTimerPause', params);
6763
}
@@ -70,7 +66,6 @@ class SensorsAnalyticsFlutterPlugin {
7066
///
7167
/// [eventName] 事件的名称
7268
static void trackTimerResume(String eventName) {
73-
assert(eventName != null);
7469
List<String> params = [eventName];
7570
_channel.invokeMethod('trackTimerResume', params);
7671
}
@@ -79,7 +74,6 @@ class SensorsAnalyticsFlutterPlugin {
7974
///
8075
/// [eventName] 事件名称
8176
static void removeTimer(String eventName) {
82-
assert(eventName != null);
8377
List<String> params = [eventName];
8478
_channel.invokeMethod('removeTimer', params);
8579
}
@@ -95,8 +89,7 @@ class SensorsAnalyticsFlutterPlugin {
9589
/// 使用示例:(计时器事件名称 viewTimer )
9690
/// SensorsAnalyticsFlutterPlugin.trackTimerEnd('viewTimer',{});
9791
///
98-
static void trackTimerEnd(String eventName, Map<String, dynamic> properties) {
99-
assert(eventName != null);
92+
static void trackTimerEnd(String eventName, Map<String, dynamic>? properties) {
10093
_convertDateTime(properties);
10194
List<dynamic> params = [eventName, properties];
10295
_channel.invokeMethod('trackTimerEnd', params);
@@ -122,7 +115,6 @@ class SensorsAnalyticsFlutterPlugin {
122115
/// SensorsAnalyticsFlutterPlugin.login('login_id');
123116
///
124117
static void login(String loginId) {
125-
assert(loginId != null);
126118
List<String> params = [loginId];
127119
_channel.invokeMethod('login', params);
128120
}
@@ -148,8 +140,7 @@ class SensorsAnalyticsFlutterPlugin {
148140
/// 使用示例:
149141
/// SensorsAnalyticsFlutterPlugin.trackViewScreen('urlForView',{'key1':'value1','key2':'value2'});
150142
///
151-
static void trackViewScreen(String url, Map<String, dynamic> properties) {
152-
assert(url != null);
143+
static void trackViewScreen(String url, Map<String, dynamic>? properties) {
153144
_convertDateTime(properties);
154145
List<dynamic> params = [url, properties];
155146
_channel.invokeMethod('trackViewScreen', params);
@@ -320,7 +311,7 @@ class SensorsAnalyticsFlutterPlugin {
320311
}
321312

322313
/// 如果 map 中的 value 字段是 DateTime 类型,将其转换成
323-
static void _convertDateTime(Map<String, dynamic> map) {
314+
static void _convertDateTime(Map<String, dynamic>? map) {
324315
if (map != null) {
325316
map.updateAll((key, value) {
326317
if (value is DateTime) {
@@ -333,18 +324,16 @@ class SensorsAnalyticsFlutterPlugin {
333324
}
334325
}
335326

336-
//TODO 本次新增方法分隔符
337-
338327
/// 设置当前 serverUrl
339328
/// [serverUrl] 当前 serverUrl
340329
/// [isRequestRemoteConfig] 是否立即请求当前 serverUrl 的远程配置,默认是 false
341330
static void setServerUrl(String serverUrl,
342331
[bool isRequestRemoteConfig = false]) {
343-
_channel.invokeMethod("setServerUrl", [serverUrl, isRequestRemoteConfig ?? false]);
332+
_channel.invokeMethod("setServerUrl", [serverUrl, isRequestRemoteConfig]);
344333
}
345334

346335
/// 返回预置属性
347-
static Future<Map<String, dynamic>> getPresetProperties() async {
336+
static Future<Map<String, dynamic>?> getPresetProperties() async {
348337
return await _channel
349338
.invokeMapMethod<String, dynamic>("getPresetProperties");
350339
}
@@ -357,7 +346,7 @@ class SensorsAnalyticsFlutterPlugin {
357346

358347
/// 设置 flush 时网络发送策略,默认 3G、4G、5G、WI-FI 环境下都会尝试 flush
359348
static void setFlushNetworkPolicy(List<SANetworkType> networkType) {
360-
if (networkType != null && networkType.isNotEmpty) {
349+
if (networkType.isNotEmpty) {
361350
int result = 0;
362351
networkType.forEach((element) {
363352
switch (element) {
@@ -456,7 +445,7 @@ class SensorsAnalyticsFlutterPlugin {
456445
/// [properties] 渠道追踪事件的属性
457446
/// [disableCallback] 是否关闭这次渠道匹配的回调请求
458447
static void trackAppInstall(
459-
[Map<String, dynamic> properties, bool disableCallback = false]) {
448+
[Map<String, dynamic>? properties, bool disableCallback = false]) {
460449
_channel.invokeMethod("trackAppInstall", [properties, disableCallback]);
461450
}
462451

@@ -471,7 +460,7 @@ class SensorsAnalyticsFlutterPlugin {
471460
}
472461

473462
/// 获取事件公共属性
474-
static Future<Map<String, dynamic>> getSuperProperties() async {
463+
static Future<Map<String, dynamic>?> getSuperProperties() async {
475464
return await _channel
476465
.invokeMapMethod<String, dynamic>("getSuperProperties");
477466
}
@@ -491,7 +480,7 @@ class SensorsAnalyticsFlutterPlugin {
491480
/// [itemId] item ID
492481
/// [properties] item 相关属性
493482
static void itemSet(String itemType, String itemId,
494-
[Map<String, dynamic> properties]) {
483+
[Map<String, dynamic>? properties]) {
495484
_channel.invokeMethod("itemSet", [itemType, itemId, properties]);
496485
}
497486

pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name: sensors_analytics_flutter_plugin
22
description: This is the official flutter plugin for Sensors Analytics,with this plugin you can easily collect your app data on Android and iOS.
3-
version: 1.0.6
4-
author: "yangzhankun <[email protected]>"
3+
version: 2.0.0
54
homepage: "https://github.com/sensorsdata/sensors_analytics_flutter_plugin"
65

76
environment:
8-
sdk: ">=2.0.0-dev.68.0 <3.0.0"
7+
sdk: ">=2.12.0 <3.0.0"
98
flutter: ">=1.10.0"
109

1110
dependencies:

sensors_analytics_flutter_plugin.iml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
<orderEntry type="sourceFolder" forTests="false" />
1616
<orderEntry type="library" name="Dart SDK" level="project" />
1717
<orderEntry type="library" name="Flutter Plugins" level="project" />
18-
<orderEntry type="library" name="Dart Packages" level="project" />
1918
</component>
2019
</module>

0 commit comments

Comments
 (0)