Right now I'm developing a Flutter app using Firebase's Realtime Database. The problem I have is that my device can't seem to connect with Firebase at all. It can't upload any data to the DB nor read anything.

The thing got weird when I tried the exact same app and code on an Android emulator, as it worked as expected.

Example code

This button below is supposed to upload something to the /carreras reference. Well, when I run an app with this code on an emulator, it works perfectly, but on my real device it doesn't.

new RaisedButton(
  child: new Text("upload"),
  onPressed: () {
    var ref = FirebaseDatabase.instance.reference().child("carreras");

    ref.set("some data").then((_) {
      Scaffold.of(context).showSnackBar(new SnackBar(
        content: new Text("data uploaded"),

My first guess is that it has to do with internet permissions but I've checked the app info on my device and emulator, and it says the app doesn't request anything. I've searched through the web too and I don't seem to find anything related nor useful.

Solution 1: KOrra

I just runned your code in real device. And it works fine. My guess is that maybe your real device's api level lower than 21. Are you running your app on a pre-Lollipop device? if it's 5.0 or higher, then my answer is wrong and the bug lies somewhere else.