Created
February 15, 2021 08:43
-
-
Save doyle-flutter/a9cb09e1d7a717d5cd5a159c76374551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:typed_data'; | |
import 'package:flutter/services.dart'; | |
class CameraLogic{ | |
// 촬영한 이미지를 저장하는 변수 | |
Uint8List camData; | |
// 촬영 기능 실행 | |
Future<void> camActionChannel() async => await new MethodChannel("app.james.cam/cam").invokeMethod<void>("cam"); | |
// 촬영한 이미지를 받음 | |
void channelOnData(Function(Uint8List) logic) => new MethodChannel("app.james.cam/cam2").setMethodCallHandler((call){ | |
if(call.method == "sendImg"){ | |
final Uint8List _data = call.arguments; | |
this.camData = _data; | |
logic(this.camData); | |
} | |
return; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment