minio-dart
minio-dart copied to clipboard
fPutObject is not defined?
The below gives me a The method 'fPutObject' isn't defined for the type 'Minio'.
error - any idea where I am going wrong? minio: ^1.3.0
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:injectable/injectable.dart';
import 'package:minio/minio.dart';
@lazySingleton
class MinioService {
final minio = Minio(
endPoint: DotEnv().env['MINIO_ENDPOINT_DEV'],
accessKey: DotEnv().env['MINIO_ACCESS_KEY_DEV'],
secretKey: DotEnv().env['MINIO_SECRET_KEY_DEV'],
useSSL: true,
);
final bucket = '00test';
final object = 'custed.png';
final copy1 = 'custed.copy1.png';
final copy2 = 'custed.copy2.png';
Future<String> uploadProductPhoto(photo) async {
final String etag = await minio.fPutObject(bucket, object, 'photos_product_upload/$object');
print('--- etag:');
print(etag);
return etag;
}
}
I can reproduce this problem.
The function fPutObject()
is defined in the extension MinioX
for the class Minio
. The latter class is defined in the file src/minio.dart
which is exported from this library, but the extension MinioX
inside the file io.dart
isn't exported.
I assume that this is not the intended behaviour because fPutObject()
is advertised in the README of this library and offers different functionality than putObject()
, @xtyxtyx ?
Bug fix: add export 'io.dart';
in minio.dart
.
I've created a pull request. See PR #19.
Because fPutObject()
and fGetObject()
depend on dart:io
, including these two functions directly in src/minio.dart
will make this package not working on web.
Similar techniques are used in packages such as shelf.