hypers_flutter_plugin 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 56

Hypers_Flutter_Plugin #

Hypers埋点sdk的flutter版本,封装了iOS&android sdk常用api

插件集成 #

参考Hypers 帮助文档

插件使用 #

在需要使用插件的dart文件中导入hypers_flutter_plugin.dart,并使用类HMTFlutterAgent调用方法,参考example项目

import 'package:hypers_flutter_plugin/hypers_flutter_plugin.dart';

0.0.1 #

  • 初始版本

1.0.0 #

  • 正式版本

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");
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  hypers_flutter_plugin: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:hypers_flutter_plugin/hypers_flutter_plugin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
13
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
56
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:hypers_flutter_plugin/hypers_flutter_plugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:hypers_flutter_plugin/hypers_flutter_plugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:hypers_flutter_plugin/hypers_flutter_plugin.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:hypers_flutter_plugin/hypers_flutter_plugin.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • hypers_flutter_plugin that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test