dmhubsdk 1.0.6 copy "dmhubsdk: ^1.0.6" to clipboard
dmhubsdk: ^1.0.6 copied to clipboard

Dmhub Flutter project.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:dmhubsdk/dmhubsdk.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  var options = DMHubOptions(
      trackUrl: 'http://xxxx/cbe/track?tid=xxxxx',
      appId: 'xxxxx',
      appName: 'test');
  options.autoTrackOpenAppEvent = true;
  options.enableDebugLogging = true;
  options.flushInterval = 40;
  DMHubClient.getInstance.initWithOptions(options).then((value) => null);

  DMHubClient.getInstance
      .setIdentity("身份证", "51028xxxxxxxxxxx299")
      .then((value) => null);
  Map<String, dynamic> mapPush = {
    'appKey': '4x33fbdafdif',
    'pushId': '55444378x',
    'provider': "这是测试的数据"
  };
  DMHubClient.getInstance.onGlobalParamsPush(mapPush);

  //
  DMHubClient.getInstance.currentIdentity().then((result) {
    DMHubLog.v(result, tag: 'identityDmhub');
  });

  //
  Map<String, dynamic> maProperties = {
    'aa': '55555555',
    'bb': '66666666',
  };
  DMHubClient.getInstance.trackMap('trackMap-44434333', maProperties);
  //
  DMHubClient.getInstance.track('track-4434333');
  //
  DMHubClient.getInstance.trackOpenView('viewcontroller');
  //
  DMHubClient.getInstance.trackExitView('viewcontroller');
  //
  DMHubClient.getInstance.setAppKey('xxxxxadb', '3434343223');
  //
  DMHubClient.getInstance
      .setAppKeyWithPushId('xxxxxadb', '44433342345', '3434343223');
  //
  DMHubClient.getInstance.onJPushReceiveRegisterId('443245454', 'fgfgfddfdfdf');
  //
  Map<String, dynamic> jpushMap = {
    'aaddf': '55555555',
    'bbdfdfd': '66666666',
  };
  DMHubClient.getInstance.onJPushReceiveMessageData(jpushMap);
  jpushMap = {
    'xabbdaddf': '55555555',
    'xbbdddfdfd': '66666666',
  };
  DMHubClient.getInstance.onJPushNotificationMessageArrived(jpushMap);
  //
  DMHubClient.getInstance.onGeTuiReceiveClientId('fdxxxx', '333334433');
  //
  DMHubClient.getInstance.trackReceiveJPushMessage(jpushMap);
  //
  DMHubClient.getInstance.trackReceiveGeTuiPayloadData(jpushMap);
  //

  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    // try {
    //   platformVersion =
    //       await Dmhubsdk.platformVersion ?? 'Unknown platform version';
    // } on PlatformException {
    //   platformVersion = 'Failed to get platform version.';
    // }

    // // If the widget was removed from the tree while the asynchronous platform
    // // message was in flight, we want to discard the reply rather than calling
    // // setState to update our non-existent appearance.
    // if (!mounted) return;

    // setState(() {
    //   _platformVersion = platformVersion;
    // });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_platformVersion\n'),
        ),
      ),
    );
  }
}
0
likes
0
pub points
59%
popularity

Publisher

unverified uploader

Dmhub Flutter project.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on dmhubsdk