flutter_fai_umeng 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new47

flutter_fai_umeng #

友盟统计 flutter 插件

Getting Started #

友盟统计插件

初始化 #

    ///友盟的初始化
    ///参数一 appkey
    ///参数二 推送使用的pushSecret
    ///参数三 是否打开调试日志
    FlutterFaiUmeng.uMengInit("5dcfb8f84ca357f70e000b0a",
        pushSecret: "5cb4fc014c143a77fb85cb17edd807a2", logEnabled: true);

    /// 监听原生消息
    FlutterFaiUmeng.receiveMessage((message) {
      print(message);
      setState(() {
        _result = message.toString();
      });
    });

0.0.2 #

  • 友盟推送功能

0.0.1 #

  • 友盟统计功能

example/lib/main.dart

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

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  String _result = '暂无数据';

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

    ///友盟的初始化
    ///参数一 appkey
    ///参数二 推送使用的pushSecret
    ///参数三 是否打开调试日志
    FlutterFaiUmeng.uMengInit("5dcfb8f84ca357f70e000b0a",
        pushSecret: "5cb4fc014c143a77fb85cb17edd807a2", logEnabled: true);

    /// 监听原生消息
    FlutterFaiUmeng.receiveMessage((message) {
      print(message);
      setState(() {
        _result = message.toString();
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('测试友盟统计 '),
        ),
        body: Center(
            child: Column(
          children: <Widget>[
            FlatButton(
              onPressed: () {
                FlutterFaiUmeng.uMengPageStart("测试页面1");
              },
              child: Text("统计页面进入"),
            ),
            FlatButton(
              onPressed: () {
                FlutterFaiUmeng.uMengPageEnd("测试页面1");
              },
              child: Text("统计页面结束"),
            ),
            FlatButton(
              onPressed: () {
                FlutterFaiUmeng.uMengEventClick("login");
              },
              child: Text("统计按钮点击事件"),
            ),
            FlatButton(
              onPressed: () {
                var falg = 1 / 0;
              },
              child: Text("测试异常"),
            ),
            FlatButton(
              onPressed: () {
                FlutterFaiUmeng.uMengError("有错误了");
              },
              child: Text("测试异常上报"),
            ),
            FlatButton(
              onPressed: () async {
                var result = await FlutterFaiUmeng.pushInit();
                setState(() {
                  _result = result['result'].toString();
                });
              },
              child: Text('注册通知'),
            ),
            FlatButton(
              onPressed: () async {
                var result = await FlutterFaiUmeng.setAlias(alias: '17700000000');
                setState(() {
                  _result = result['result'].toString();
                });
              },
              child: Text('设置别名'),
            ),
            Expanded(
              child: Text(_result),
            ),
          ],
        )),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_fai_umeng: ^0.0.2

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:flutter_fai_umeng/flutter_fai_umeng.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

We analyzed this package on Jul 9, 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:flutter_fai_umeng/flutter_fai_umeng.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

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

Package does not support Flutter platform web

Because:

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

Package does not support Flutter platform windows

Because:

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

Package not compatible with SDK dart

Because:

  • flutter_fai_umeng that is a package requiring null.

Health suggestions

Fix lib/src/native_umen.dart. (-1.99 points)

Analysis of lib/src/native_umen.dart reported 4 hints:

line 1 col 8: Unused import: 'dart:async'.

line 2 col 8: Unused import: 'dart:io'.

line 6 col 8: Unused import: 'package:flutter/services.dart'.

line 38 col 10: This function has a return type of 'Widget', but doesn't end with a return statement.

Fix lib/flutter_fai_umeng.dart. (-1 points)

Analysis of lib/flutter_fai_umeng.dart reported 2 hints:

line 109 col 16: The value of the field '_channel' isn't used.

line 110 col 16: Name non-constant identifiers using lowerCamelCase.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
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