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

A flutter plugin that helps developer to collect app data on android and iOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:hypers_flutter_plugin/hypers_flutter_plugin.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Hypers Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text("Hypers Flutter Demo"),
      ),
      body: ListView(
        children: <Widget>[
          RaisedButton(
            onPressed: _onAction1,
            child: Text("sendAction"),
          ),
          RaisedButton(
            onPressed: _onAction2,
            child: Text("sendActionWithCount"),
          ),
          RaisedButton(
            onPressed: _onAction3,
            child: Text("sendActionWithCountAndParams"),
          ),
          RaisedButton(
            onPressed: _sendActivityStart,
            child: Text("sendActivityStart"),
          ),
          RaisedButton(
            onPressed: _sendActivityEnd,
            child: Text("sendActivityEnd"),
          ),
          RaisedButton(
            onPressed: _identify,
            child: Text("identify"),
          ),
        ],
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

var extraProperty = const {
  "key1": "value1",
  "key2": 123,
  "key3": "值",
  "key4": {"sub_key1": "sub_value1"},
  "key5": ["value1", "value2", "value3"],
  "key6": [
    {"sub_key": 123}
  ],
  "key7": [
    [
      [
        {"sub_key": "sub_value"}
      ]
    ]
  ],
  "key8": [
    [
      [
        [
          {"sub_key": "sub_value"}
        ]
      ]
    ]
  ],
};

void _onAction1() {
  HMTFlutterAgent.sendAction("actionName");
}

void _onAction2() {
  HMTFlutterAgent.sendAction("actionName", actionCount: 22);
}

void _onAction3() {
  HMTFlutterAgent.sendAction("actionName",
      actionCount: 22, actionParams: extraProperty);
}

void _sendActivityStart() {
  HMTFlutterAgent.sendActivityStart("pageName");
}

void _sendActivityEnd() {
  HMTFlutterAgent.sendActivityEnd("pageName",
      activityParams: {"activity_key": "activity_value"});
}

void _identify() {
  HMTFlutterAgent.identify("accountId");
}
1
likes
25
pub points
0%
popularity

Publisher

verified publisherdev.hypers.com.cn

A flutter plugin that helps developer to collect app data on android and iOS.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on hypers_flutter_plugin