mock_data 1.0.1 mock_data: ^1.0.1 copied to clipboard
Generate random data(string, integer, IPs, etc...)
example/mock_data_example.dart
import 'package:mock_data/mock_data.dart';
main() {
// Mock string of given length and group of characters.
mockString(); // default length of 16 and include of '!'.
mockString(10);
mockString(15, 'a#');
mockString(3, '!');
mockString(7, 'aA');
// Mock integer in range of min to max.
mockInteger(); // default min set to 1 and max to 10.
mockInteger(3, 30);
mockInteger(-15, 5);
mockInteger(-25, -15);
// Mock IPv4 with given format.
mockIPv4(); // default format set to '*.*.*.*'.
mockIPv4('192.168.0.*');
mockIPv4('192.168.*.*');
mockIPv4('192.*.*.55');
// Generate range of mocks of particular function(more at [mockRange]).
mockRange(mockString, 3);
mockRange(mockInteger, 5, min: 3, max: 15);
mockRange(mockIPv4, 7, format: '*.*.0.0');
}