mock_creator_generator 1.0.8

Dart native

Creates a mock for classes with a single call method making it easy for us to create those mocks automatically.

You want a generator to create a mock from a call method? Append @MockCreator() to your class name.

@MockCreator()
class SalutationAppender {
  String call(String name) {
    if (["Bob", "Rob", "Todd"].contains(name)) {
      return "Mr " + name;
    }

    return "Mrs " + name;
  }
}

class SalutationAppender_Mock extends SalutationAppender {
  final String Function(
    String name,
  ) fn;

  SalutationAppender_Mock(this.fn);

  String call(
    String a,
  ) =>
      fn(a);
}
0
likes
70
pub points
1%
popularity

Creates a mock for classes with a single call method making it easy for us to create those mocks automatically.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

atreeonhill@gmail.com

License

MIT (LICENSE)

Dependencies

analyzer, basic_utils, build, dartx, dartz, meta, mock_creator_annotation, quiver, source_gen, typedef_for_fn_generator

More

Packages that depend on mock_creator_generator