我实现了此功能,但仍然出现以下错误,我无法弄清原因。
/usr/include/c++/4.8/bits/stl_algo.h:6325: error: no match for call to '(Farm::killHeaviestAnimalOnFarm()::__lambda0) (Animal*&, Animal*&)' if (__comp(*__result, *__first)) ^
Run Code Online (Sandbox Code Playgroud)
我在互联网上搜索了一些示例,但看不到我和我之间有什么区别。
我的.cpp文件具有以下killHeaviestAnimalOnFarm
Animal *Farm::killHeaviestAnimalOnFarm()
{
auto minmax_widths = std::max_element(animals.begin(), animals.end(),
[] (Animal const& lhs, Animal const& rhs) {
return lhs.getWeight() < rhs.getWeight();
});
}
Run Code Online (Sandbox Code Playgroud) 我想分享一张从 CameraController 拍摄的图像。
我的文件位置例如 /data/user/0/com.user.test/cache/2019-09-10 16:32:52.281842.png
如何共享这个本地图像?
我添加了这两行用于读/写本地存储:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Run Code Online (Sandbox Code Playgroud)
我使用https://pub.dev/packages/esys_flutter_share中的共享组件,效果很好。
void _sharePicture() async {
print('Share picture');
print(this.imagePath);
final ByteData bytes = await rootBundle.load(this.imagePath);
await Share.file('esys image', 'esys.png', bytes.buffer.asUint8List(), 'image/png', text: 'My optional text.');
}
Run Code Online (Sandbox Code Playgroud)
this.imagePath 是文件的本地位置: :/data/user/0/com.user.test/cache/2019-09-10 16:32:52.281842.png
您首先必须保存图像吗?并用它来分享?怎么可能分享这个本地图片呢?