1.2.1.4 Flutter SDK使用说明

优质
小牛编辑
133浏览
2023-12-01

Flutter SDK 使用文档

1.1. Flutter 插件获取安装

根据 dart pub 文档获取安装

1.2. Android 集成(Native部分)

此 Flutter 插件运行在 Android 手机上时依赖于 Hubble Android SDK,请参考 Hubble Android SDK 集成

1.3. iOS 集成(Natvie部分)

此 Flutter 插件运行在 iOS 手机上时依赖于 Hubble iOS SDK,请参考 Hubble iOS SDK 集成

2.1. track

说明:自定义事件埋点

参数类型是否必填说明
eventIdString事件ID
attributesString自定义属性

调用示例:

import 'package:flutter_hubble_track/flutter_hubble_track.dart';
FlutterHubbleTrack.track("eventId");
FlutterHubbleTrack.track("eventId", {"k1": "v1", "k2": "v2"});

2.2. upload

说明:手动发送数据

调用示例:

import 'package:flutter_hubble_track/flutter_hubble_track.dart';
FlutterHubbleTrack.upload();

2.3. loginUser

说明:用户登录

参数类型是否必填说明
userIdString用户ID

调用示例:

import 'package:flutter_hubble_track/flutter_hubble_track.dart';
FlutterHubbleTrack.loginUser("userId");

2.4. logoutUser

说明:退出登录

调用示例:

import 'package:flutter_hubble_track/flutter_hubble_track.dart';
FlutterHubbleTrack.logoutUser();

2.5. setLocation

说明:用户位置记录

参数类型是否必填说明
latitudedouble纬度
longitudedouble经度

调用示例:

import 'package:flutter_hubble_track/flutter_hubble_track.dart';
FlutterHubbleTrack.setLocation(0.0,0.0);

2.6. trackTimer(详细用法参考Native部分文档)

说明:事件耗时统计

参数类型是否必填说明
eventIdString事件ID

调用示例:

import 'package:flutter_hubble_track/flutter_hubble_track.dart';
FlutterHubbleTrack.trackTimer("eventId");