stubJsonFileImpl function

Future<JokerStub> stubJsonFileImpl({
  1. String? host,
  2. String? path,
  3. String? method,
  4. required String filePath,
  5. int statusCode = 200,
  6. Map<String, String> headers = const {},
  7. Duration? delay,
  8. String? name,
  9. bool removeAfterUse = false,
})

Implementation for native platforms (mobile, desktop, server)

This provides file operations that require dart:io.

Implementation

Future<JokerStub> stubJsonFileImpl({
  String? host,
  String? path,
  String? method,
  required String filePath,
  int statusCode = 200,
  Map<String, String> headers = const {},
  Duration? delay,
  String? name,
  bool removeAfterUse = false,
}) async {
  final response = await JokerResponseFile.jsonFile(
    filePath,
    statusCode: statusCode,
    headers: headers,
    delay: delay,
  );

  // Use the public stubUrl method to register the stub
  return Joker.stubUrl(
    host: host,
    path: path,
    method: method,
    response: response,
    name: name,
    removeAfterUse: removeAfterUse,
  );
}