automock 1.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 50

Automock #

An automatic mock server to speed up your initial development.

Example #

final File file = File('swagger.json');
final String swagger = await file.readAsString();

final Automock automock = Automock(
  port: 8080,
  swaggerJson: swagger,
);
await automock.start();

[1.0.0] - 2020-04-24 #

  • First version

[1.0.1] - 2020-04-24 #

  • Fixed warnings

[1.0.2] - 2020-05-07 #

  • Fixed end point matching

[1.1.0] - 2020-05-26 #

  • Using mock server

[1.2.0] - 2020-05-28 #

  • Using latest mock server

example/main.dart

import 'dart:io';
import 'package:automock/automock.dart';

Future<dynamic> main() async {
  final File file = File('example/swagger.json');
  final String swagger = await file.readAsString();

  final Automock automock = Automock(
    port: 8080,
    swaggerJson: swagger,
  );
  await automock.start();
}

Use this package as a library

1. Depend on it

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


dependencies:
  automock: ^1.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:automock/automock.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]
100
Overall:
Weighted score of the above. [more]
50
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

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:automock/automock.dart that imports:
  • package:automock/src/automock/automock.dart that imports:
  • package:mockserver/mockserver.dart that imports:
  • package:mockserver/src/mockserver/mock_server.dart that imports:
  • package:mockserver/src/mockserver/end_point.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:automock/automock.dart that imports:
  • package:automock/src/automock/automock.dart that imports:
  • package:mockserver/mockserver.dart that imports:
  • package:mockserver/src/mockserver/mock_server.dart that imports:
  • package:mockserver/src/mockserver/end_point.dart that imports:
  • dart:io

Health issues and suggestions

Document public APIs. (-1 points)

7 out of 7 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.

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

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

line 21 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.8.0 <3.0.0
json_annotation ^3.0.1 3.0.1
mockserver ^1.2.0 1.2.1
Dev dependencies
build_runner ^1.10.0
http ^0.12.1
json_serializable ^3.3.0
test ^1.14.5