Flutter: List All Firebase Apps and App Details/Options

8/25/2020 5:13:15 PM

List all Firebase Apps configured.

*If the results are not what you expect, run flutter clean in a terminal window at the root of the flutter project.

import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';

class TestApp extends StatelessWidget {
  Future listFirebaseApps() async {
    print("listFirebaseApps");
    final List apps = Firebase.apps;
    if (apps != null) {
      for (int x = 0; x < apps.length; x++) {
        if (x == 0) {
          print("DEFAULT APP");
        }

        print("App Name: ${apps[x].name}");

        var appOptions = apps[x].options;
        print("App Options: " + appOptions.toString());
      }
    } else {
      print("NO APPS FOUND");
    }
  }

  @override
  Widget build(BuildContext context) {
    listFirebaseApps();

    return new MaterialApp(
      home: Container(
        child: Text("runnning tests"),
      )
    );
  }
}