cloudwise_flutter_plugin 2.5.1
cloudwise_flutter_plugin: ^2.5.1 copied to clipboard
This is the official flutter plugin for Cloudwise,with this plugin you can easily collect your app data on Android and iOS.
example/lib/main.dart
import 'anr/Anr.dart';
import 'crash/Crash.dart';
import 'crash/JavaCrashPage.dart';
import 'custom/Custom.dart';
import 'custom/CustomEvent.dart';
import 'h5/H5DetailPage.dart';
import 'http/DioPage.dart';
import 'http/Http.dart';
import 'http/HttpClientPage.dart';
import 'socket/Socket.dart';
import 'image/ImagePage.dart';
import 'http/DioIsolatePage.dart';
import 'package:flutter/material.dart';
import 'h5/H5Page.dart';
import 'h5/WebviewPage.dart';
import 'http/HttpPage.dart';
import 'http/IsolatePage.dart';
import 'package:cloudwise_flutter_plugin/src/cloudwise_flutter_plugin.dart';
import 'package:cloudwise_flutter_plugin/src/CloudwiseRouteObserver.dart';
main() {
runApp(MyApp());
CloudwiseImpl().setCustomDeviceId("jack11111");
CloudwiseImpl().setCustomUserInfo("davis", Map());
const configuration = Configuration(
isDebug: true,
datadomain: "http://10.0.7.115:18080",
appkey: "wS0n2SF8WRDB0iOsCaTCO**BpxQfmmgrW6LMhf**m5T58j2qC0hFR0UeFWfGr9EXmY"
);
configuration.setAppVersion("2.5.1");
CloudwiseImpl().start(MyApp(), configuration: configuration);
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
routes: {
'/main': (context) => MainWeight(),
'/Http': (context) => Http(),
'/DioPage': (context) => DioPage(),
'/HttpClientPage': (context) => HttpClientPage(),
'/HttpPage': (context) => HttpPage(),
'/IsolatePage': (context) => IsolatePage(),
'/H5Page': (context) => H5Page(),
'/WebviewPage': (context) => WebViewExample(),
'/DioIsolatePage': (context) => DioIsolatePage(),
'/H5DetailPage': (context, {arguments}) => H5DetailPage(ModalRoute.of(context)?.settings.arguments),
'/Crash': (context) => Crash(),
'/JavaCrashPage': (context) => JavaCrashPage(),
'/Anr': (context) => Anr(),
'/Socket': (context) => MSocket(),
'/Custom': (context) => Custom(),
'/CustomEvent': (context) => CustomEvent(),
'/CustomUserInfo': (context) => CustomEvent(),
'/ImagePage': (context) => ImagePage()
},
onUnknownRoute: (RouteSettings settings) {
String? name = settings.name;
print("未匹配到路由:$name");
return null;
},
navigatorObservers: [
CloudwiseRouteObserver()
],
home: MainWeight());
}
}
class MainWeight extends StatefulWidget {
@override
State<StatefulWidget> createState() => _mainWeight();
}
class _mainWeight extends State<MainWeight>{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Cloudwise Flutter Demo'), centerTitle: true),
body: Container(
width: double.infinity,
child: Column(
children: [
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/Http');
},
child: Text(
"HTTP请求",
style: TextStyle(fontSize: 20),
),
),
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/Crash');
},
child: Text(
"Crash崩溃",
style: TextStyle(fontSize: 20),
),
),
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/H5Page');
},
child: Text(
"H5请求",
style: TextStyle(fontSize: 20),
),
),
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/Anr');
},
child: Text(
"ANR",
style: TextStyle(fontSize: 20),
),
),
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/Socket');
},
child: Text(
"SOCKET",
style: TextStyle(fontSize: 20),
),
),
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/Custom');
},
child: Text(
"自定义接口",
style: TextStyle(fontSize: 20),
),
),
new TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/ImagePage');
},
child: Text(
"加载图片",
style: TextStyle(fontSize: 20),
),
),
],
),
));
}
}