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

outdated

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://a.dmhub.cn/cbe/track?tid=1734229266',
      appId: 'app17e2d396ddf0037ab',
      appName: 'smart-test');
  options.autoTrackOpenAppEvent = true;
  options.enableDebugLogging = true;
  DMHubClient.getInstance.init(options).then((value) => null);

  DMHubClient.getInstance
      .setIdentity("身份证", "510283198212247299")
      .then((value) => null);
  Map<String, dynamic> mapPush = {
    'appKey': '4x33fbdafdif',
    'pushId': '55444378x',
    'provider': "这是测试的数据"
  };
  DMHubClient.getInstance.onGlobalParamsPush(mapPush);
  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'),
        ),
      ),
    );
  }
}
copied to clipboard
0
likes
0
points
44
downloads

Publisher

unverified uploader

Weekly Downloads

2024.08.27 - 2025.03.11

Dmhub Flutter project.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on dmhubsdk