inventiv_critic_flutter 0.0.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 51

critic_flutter #

This plugin allows Flutter apps to interact with the Inventiv Critic system for bug tracking and reporting. You will need to have a Critic account to properly utilize this. Please visit the Critic website for more information.

How to use #

Step 1: Initialize the Critic library using your api key:

String key = 'your api key';
Critic().initialize(key);

Step 2: Create a new Bug Report using the .create const:

BugReport report = BugReport.create(
    description: 'description text',
    stepsToReproduce: 'steps to reproduce text',
);

Step 3: Attach a file, if necessary

File file = File('path to file');
report.attachments = <Attachment>[];
report.attachments.add(Attachment(name: 'test file', path: file.path));

Step 4: Use the Critic() singleton to submit your BugReport (example using Futures):

Critic().submitReport(report).then(
    (BugReport successfulReport) {
      //success!
    }).catchError((Object error) {
      //failure
    });

Step 5: Review bugs submitted for your organization using Critic's web portal

0.0.7 #

Upgraded all dependencies that were causing issues with newest Flutter versions (1.17.x).

0.0.5 #

Multiple attachments can be uploaded properly. Add battery and network connection to device status.

0.0.4 #

Added attachment support.

0.0.2 #

Cleaned up readme files for better published documents.

0.0.1 #

Initial version of the Critic integration. Supports bug reporting with custom description and steps to reproduce. All device platform information is gathered as well.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';

import 'package:inventiv_critic_flutter/critic.dart';
import 'package:inventiv_critic_flutter/modal/bug_report.dart';
import 'package:path_provider/path_provider.dart';

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

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

class _MyAppState extends State<MyApp> {
  TextEditingController _descriptionController = new TextEditingController(),
      _reproduceController = new TextEditingController();

  @override
  void initState() {
    super.initState();
    Critic().initialize('gJ44GxttrahyVBFs4k3jb8T1');
  }

  void _submitReport(BuildContext context, {bool withFile = false}) async {
    BugReport report = BugReport.create(
        description: _descriptionController.text,
        stepsToReproduce: _reproduceController.text);

    if(withFile){
      report.attachments = <Attachment>[];
      Directory dir = await getApplicationDocumentsDirectory();
      File file = File('${dir.path}/test.txt');
      File writtenFile = await file.writeAsString('Test file upload', mode: FileMode.write);
      report.attachments.add(Attachment(name: 'test file', path: writtenFile.path));
    }

    Critic().submitReport(report).then((BugReport successfulReport) {
      Scaffold.of(context).showSnackBar(new SnackBar(
        content: new Text('Bug Report has been filed, check console'),
      ));
      print(
          'Successfully logged!\ndescription: ${successfulReport.description}\nsteps to reproduce: ${successfulReport.stepsToReproduce}');
    }).catchError((Object error) {
      print(error.toString());
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(25.0),
          child: Builder(
            builder: (context) => Column(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: <Widget>[
                    Text('Enter a description'),
                    TextField(
                      controller: _descriptionController,
                    ),
                    Text('Enter steps to reproduce'),
                    TextField(
                      controller: _reproduceController,
                    ),
                    MaterialButton(
                      color: Colors.grey,
                      onPressed: () {
                        _submitReport(context);
                      },
                      child: Text('Test Submit'),
                    ),
                    MaterialButton(
                      color: Colors.grey,
                      onPressed: () {
                        _submitReport(context, withFile: true);
                      },
                      child: Text('Test Submit with file'),
                    ),
                  ],
                ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  inventiv_critic_flutter: ^0.0.7

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:inventiv_critic_flutter/api.dart';
import 'package:inventiv_critic_flutter/critic.dart';
import 'package:inventiv_critic_flutter/modal/app.dart';
import 'package:inventiv_critic_flutter/modal/bug_report.dart';
import 'package:inventiv_critic_flutter/modal/device.dart';
import 'package:inventiv_critic_flutter/modal/ping_request_modal.dart';
import 'package:inventiv_critic_flutter/modal/ping_response.dart';
import 'package:inventiv_critic_flutter/modal/report_request_modal.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
65
Overall:
Weighted score of the above. [more]
51
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:inventiv_critic_flutter/api.dart, package:battery/battery.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

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

Package does not support Flutter platform web

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

Package does not support Flutter platform windows

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

Package not compatible with SDK dart

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

Health issues and suggestions

Document public APIs. (-1 points)

103 out of 103 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/api.dart.

Run flutter format to format lib/api.dart.

Format lib/critic.dart.

Run flutter format to format lib/critic.dart.

Format lib/modal/app.dart.

Run flutter format to format lib/modal/app.dart.

Fix additional 5 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/modal/bug_report.dart (Run flutter format to format lib/modal/bug_report.dart.)
  • lib/modal/device.dart (Run flutter format to format lib/modal/device.dart.)
  • lib/modal/ping_request_modal.dart (Run flutter format to format lib/modal/ping_request_modal.dart.)
  • lib/modal/ping_response.dart (Run flutter format to format lib/modal/ping_response.dart.)
  • lib/modal/report_request_modal.dart (Run flutter format to format lib/modal/report_request_modal.dart.)

Maintenance suggestions

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.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
battery ^1.0.1 1.0.1
connectivity ^0.4.8+6 0.4.9
device_info ^0.4.2+4 0.4.2+4
dio ^3.0.9 3.0.9
flutter 0.0.0
http ^0.12.1 0.12.1
mime ^0.9.6+3 0.9.6+3
package_info ^0.4.1 0.4.1
Transitive dependencies
charcode 1.1.3
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
flutter_web_plugins 0.0.0
http_parser 3.1.4
js 0.6.2
meta 1.1.8 1.2.1
path 1.7.0
pedantic 1.9.0 1.9.1
plugin_platform_interface 1.0.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety