I am trying to upload a pdf-file
to Firebase-Storage
using this function:
static Future<String> savePdf({
required Uint8List assetAsUint8List,
required String fileName,
required DocumentType documentType,
}) async {
String path =
'${BackendService().keys.studs}/${AuthenticationService().currentUser?.uid}/${documentType.name}/$fileName';
await FirebaseStorage.instanceFor().ref(path).putData(
assetAsUint8List,
);
return FirebaseStorage.instance.ref(path).getDownloadURL();
}
but this fails with this error
:
Unhandled Exception: [firebase_storage/no-bucket] No default storage bucket could be found. Ensure you have correctly followed the Getting Started guide.
I configure
my app like this inside my main
:
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: kIsWeb || Platform.isAndroid
? FirebaseOptions(
apiKey: "my-api-key",
appId: "my-app-id",
messagingSenderId: "my-messaing-sender-id",
projectId: "appflug",
)
: null,
);
runApp(
const App(),
);
}
It is actually working on iOS! But NOT on Android or Web...
I followed the documentation but it is simply not working... I coulnd't find anything helpful on this!
What am I missing here?
Let me know if you need any more info!