I'm trying to put a default image in storage when I create a new user. I made that when you create a new accout automatically create a file in storage on firebase with the user uid, now I'm trying to put in the file a image from my assets
How do I do this?
I tried something with metadata but doesn't work
Future<void> resUser() async {
try {
final userCredential = await FirebaseAuth.instance.createUserWithEmailAndPassword(
email: _gmailController.text,
password: _contrasenaController.text,
);
final uid = userCredential.user!.uid;
String newDirectory = uid;
final metadata = SettableMetadata(contentType: "assets/usuariDef.png");
await FirebaseStorage.instance.ref('imagenes/$uid').putFile(metadata);
addUser(_usuarioController.text, _gmailController.text, _contrasenaController.text,uid);
} catch (e) {
// Handle any errors
print('Error creating user: $e');
}
}