Flutter 插件faro_dart的使用
faro_dart
Grafana Faro,但用于 Dart(和 Flutter)。
使用
请参阅 ./example/faro_dart_example.dart
Future<void> main() async {
await Faro.init(
(options) {
var app = App("my-app", "0.0.1", "dev");
options.collectorUrl = Uri.parse('https://your-collector.com/collector');
options.meta = Meta(app: app);
},
// 初始化您的应用。
appRunner: () async => await realMain(),
);
}
realMain() async {
// 发送日志消息
Faro.pushLog("delay");
// 发送测量数据
Faro.pushMeasurement("delay", 2);
// 发送事件
Faro.pushEvent(Event("cta", attributes: {
"foo": "bar",
}));
Faro.pushView("home");
// 发送错误
try {
throw 'foo!';
} catch (e, s) {
Faro.pushError(e, stackTrace: s);
}
// 暂停记录
await Faro.pause();
// 恢复记录
await Faro.unpause();
// 强制清空缓冲区
await Faro.drain();
}
更多关于Flutter 插件faro_dart的使用的实战教程也可以访问 https://www.itying.com/category-92-b0.html
1 回复