Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:io';
- import 'dart:typed_data';
- import 'package:path_provider/path_provider.dart';
- import 'package:image_picker_test/main.dart' as app;
- import 'package:flutter_driver/driver_extension.dart';
- import 'package:flutter/services.dart';
- void main() {
- // This line enables the extension.
- enableFlutterDriverExtension();
- const MethodChannel channel =
- MethodChannel('plugins.flutter.io/image_picker');
- channel.setMockMethodCallHandler((MethodCall methodCall) async {
- ByteData data = await rootBundle.load('images/sample.png');
- Uint8List bytes = data.buffer.asUint8List();
- Directory tempDir = await getTemporaryDirectory();
- File file = await File('${tempDir.path}/tmp.tmp', ).writeAsBytes(bytes);
- print(file.path);
- return file.path;
- });
- app.main();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement