useStorageEmulator method
Changes this instance to point to a Storage emulator running locally.
Set the host
(ex: localhost) and port
(ex: 9199) of the local emulator.
Note: Must be called immediately, prior to accessing storage methods. Do not use with production credentials as emulator traffic is not encrypted.
Note: storage emulator is not supported for web yet. firebase-js-sdk does not support storage.useStorageEmulator until v9
Implementation
@override
Future<void> useStorageEmulator(String host, int port) async {
emulatorHost = host;
emulatorPort = port;
try {
await MethodChannelFirebaseStorage.channel
.invokeMethod('Storage#useEmulator', <String, dynamic>{
'appName': app.name,
'maxOperationRetryTime': maxOperationRetryTime,
'maxUploadRetryTime': maxUploadRetryTime,
'maxDownloadRetryTime': maxDownloadRetryTime,
'bucket': bucket,
'host': emulatorHost,
'port': emulatorPort
});
} catch (e, s) {
convertPlatformException(e, s);
}
}