SHARE
TWEET

Untitled

a guest Jun 16th, 2019 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'dart:io';
  2. import 'dart:typed_data';
  3. import 'package:path_provider/path_provider.dart';
  4.  
  5. import 'package:image_picker_test/main.dart' as app;
  6. import 'package:flutter_driver/driver_extension.dart';
  7. import 'package:flutter/services.dart';
  8. void main() {
  9.   // This line enables the extension.
  10.   enableFlutterDriverExtension();
  11.  
  12.   const MethodChannel channel =
  13.   MethodChannel('plugins.flutter.io/image_picker');
  14.  
  15.   channel.setMockMethodCallHandler((MethodCall methodCall) async {
  16.     ByteData data = await rootBundle.load('images/sample.png');
  17.     Uint8List bytes = data.buffer.asUint8List();
  18.     Directory tempDir = await getTemporaryDirectory();
  19.     File file = await File('${tempDir.path}/tmp.tmp', ).writeAsBytes(bytes);
  20.     print(file.path);
  21.     return file.path;
  22.   });
  23.  
  24.  
  25.   app.main();
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top