easy_mock_package_info 0.1.0 copy "easy_mock_package_info: ^0.1.0" to clipboard
easy_mock_package_info: ^0.1.0 copied to clipboard

Readable test mock for package_info_plus. Sets PackageInfo through the package's own setMockInitialValues seam (it caches the result, so a raw channel mock would be unreliable).

easy_mock_package_info #

A readable test mock for package_info_plus.

Unlike the other easy_mock_* packages, this one depends on package_info_plus on purpose: the plugin caches PackageInfo.fromPlatform() and exposes its own setMockInitialValues test seam, so a raw channel mock would be shadowed by that cache. This package just drives the official seam with a readable API and per-test reset.

Usage #

import 'package:easy_mock_package_info/easy_mock_package_info.dart';

mockPackageInfo.init();                          // harness usually does this
mockPackageInfo.set(version: '2.3.4', buildNumber: '42');

// app code: (await PackageInfo.fromPlatform()).version == '2.3.4'

set({appName, packageName, version, buildNumber}); defaults are epay / ly.anis.epay / 1.0.0 / 1. install() resets to those.

0
likes
140
points
120
downloads

Documentation

API reference

Publisher

verified publisherahmedomar.com.ly

Weekly Downloads

Readable test mock for package_info_plus. Sets PackageInfo through the package's own setMockInitialValues seam (it caches the result, so a raw channel mock would be unreliable).

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_test, package_info_plus

More

Packages that depend on easy_mock_package_info