live_game_lib 0.3.8 copy "live_game_lib: ^0.3.8" to clipboard
live_game_lib: ^0.3.8 copied to clipboard

A Game Libary for creating live multiplayergames with flutter and firebase very fast and easy.

example/lib/main.dart

import 'package:example/firebase_options.dart';
import 'package:example/gamelist.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:live_game_lib/backend/gamemanager.dart';

/// The [GameManager] instance for managing games in the application.
GameManager? inst;

/// The main function to run the Flutter application.
void main() async {
  // Ensure that Flutter is initialized.
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize Firebase with the specified options.
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

  // Create an instance of the [GameManager] with the available games.
  inst = GameManager(games: games);

  // Run the Flutter application.
  runApp(const MyApp());
}

/// The main application widget.
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Live Games Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      initialRoute: '/',
      routes: inst?.routes, // Set the routes based on the GameManager instance.
    );
  }
}
2
likes
160
pub points
55%
popularity

Publisher

unverified uploader

A Game Libary for creating live multiplayergames with flutter and firebase very fast and easy.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

firebase_core, firebase_database, flutter, playing_cards

More

Packages that depend on live_game_lib