firebase_for_all 0.0.6 copy "firebase_for_all: ^0.0.6" to clipboard
firebase_for_all: ^0.0.6 copied to clipboard

This package is the way to use firebase features on all platforms without code changes. This package will deal with channelizing task of these packages for you. It will automatically switch between p [...]

example/lib/main.dart

import 'package:flutter/material.dart';
// ignore: depend_on_referenced_packages
import 'package:firebase_for_all/firebase_for_all.dart';
import 'firebase_options.dart';
import 'functions.dart';

void main() async {
  await FirebaseCoreForAll.initializeApp(
      options: DefaultFirebaseOptions.currentPlatform,
      firestore: true,
      auth: true,
      storage: true);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: "title"),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: CollectionBuilder(
        stream: FirestoreForAll.instance.collection("users").snapshots(),
        builder: (BuildContext context,
            AsyncSnapshot<QuerySnapshotForAll> snapshot) {
          if (snapshot.hasError) {
            return const Text('Something went wrong');
          }

          if (snapshot.connectionState == ConnectionState.waiting) {
            return const Text("Loading");
          }

          return ListView(
            children:
                snapshot.data!.docs.map((DocumentSnapshotForAll document) {
              Map<String, dynamic> data =
                  document.data() as Map<String, dynamic>;
              return ListTile(
                title: Text(data['name']),
                subtitle: Text(data['surname']),
              );
            }).toList(),
          );
        },
      ),
      floatingActionButton: const FloatingActionButton(
        onPressed: getCollection,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
30
likes
0
pub points
69%
popularity

Publisher

verified publisherflutterway.net

This package is the way to use firebase features on all platforms without code changes. This package will deal with channelizing task of these packages for you. It will automatically switch between packages and allow you to run "Firedart" on Windows and "cloud_firestore" on any other platform.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cloud_firestore, cupertino_icons, firebase_auth, firebase_auth_desktop, firebase_core, firebase_core_desktop, firebase_dart, firebase_storage, firedart, flutter, get, http

More

Packages that depend on firebase_for_all