x_monitor_flutter 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

x_monitor_flutter #

安装 #

dependencies:
  x_monitor_flutter: ^0.1.0

使用

import 'package:x-monitor-flutter/x_monitor_flutter.dart';
# 入口

void main() {
  XMonitorFlutter appXMonitorFlutter = XMonitorFlutter();
  // 配置基础信息
  appXMonitorFlutter.setConfig({
    'key': 'xxx',// 应用唯一key (必填 )
    'url':'' // 指定错误上报地址 (必填 )
    'performanceUrl':'',// 性能数据上报地址(可选 )
    'userId':'',// 生成guid规则(可选 )
    'guid':''// userId(可选 )
  });
  // 获取gps 以及 flutterSDK 基础版本库
  appXMonitorFlutter.setReportSystemOption(locationInfo: {'latitude': 10, 'longitude': 10},frameVersion: '0.1.5');

  return appXMonitorFlutter.catchRun((){
    runApp(MyApp());
  });
}

0.1.0 #

  • 新增页面白名单、api白名单
  • 上报入参调整

0.0.2 #

  • read me release

0.0.1 #

  • Initial release

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:x_monitor_flutter/x_monitor_flutter.dart';

void main() => 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.
    try {
      platformVersion = await XMonitorFlutter.platformVersion;
    } 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'),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  x_monitor_flutter: ^0.1.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:x_monitor_flutter/x_monitor_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:x_monitor_flutter/x_monitor_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:x_monitor_flutter/x_monitor_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:x_monitor_flutter/x_monitor_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:x_monitor_flutter/x_monitor_flutter.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [x_monitor_flutter] that is in a package requiring null.

Health suggestions

Fix lib/src/report_system_info.dart. (-0.50 points)

Analysis of lib/src/report_system_info.dart reported 1 hint:

line 1 col 1: Prefer using /// for doc comments.

Fix lib/x_monitor_flutter.dart. (-0.50 points)

Analysis of lib/x_monitor_flutter.dart reported 1 hint:

line 32 col 10: 'onError' is deprecated and shouldn't be used. Use runZonedGuarded instead.

Format lib/src/report_error.dart.

Run flutter format to format lib/src/report_error.dart.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (battery, dio).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
battery ^0.3.0+4 0.3.1+10 1.0.1
connectivity ^0.4.3+2 0.4.9
device_info ^0.4.0+1 0.4.2+4
dio ^2.1.0 2.2.2 3.0.9
flutter 0.0.0
package_info ^0.4.0+2 0.4.1
Transitive dependencies
collection 1.14.12 1.14.13
connectivity_for_web 0.3.0
connectivity_macos 0.1.0+3
connectivity_platform_interface 1.0.6
cookie_jar 1.0.1
flutter_web_plugins 0.0.0
js 0.6.2
meta 1.1.8 1.2.1
plugin_platform_interface 1.0.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test