mirrored_repositories/felexo-app/lib
import 'package:felexo/Data/favorites-data.dart';
import 'package:felexo/Services/favorites-list.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class FavoritesView extends StatefulWidget {
  @override
  _FavoritesViewState createState() => _FavoritesViewState();
}

class _FavoritesViewState extends State<FavoritesView> {
  final FirebaseAuth _auth = FirebaseAuth.instance;
  User user;

  @override
  void initState() {
    initUser();
    super.initState();
  }

  initUser() async {
    user = _auth.currentUser;
    assert(user.email != null);
    assert(user.uid != null);
    assert(user.photoURL != null);

    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 800,
      child: StreamProvider<List<Favorites>>.value(
          value: DatabaseService(uid: user.uid).favorites,
          initialData: [],
          child: FavoritesList()),
    );
  }
}
