masamune_agora 2.4.42 copy "masamune_agora: ^2.4.42" to clipboard
masamune_agora: ^2.4.42 copied to clipboard

unlisted

Plug-in for Masamune framework to use Agora.io. Includes support for recording.

example/lib/main.dart

// Dart imports:

// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:masamune/masamune.dart';
import 'package:masamune_agora/masamune_agora.dart';

final List<MasamuneAdapter> masamuneAdapters = [
  const AgoraMasamuneAdapter(
    appId: "e3306fb870954eb880242a756a56c883",
    customerId: "4def5dd9abb0475faa69a5edd1328e6e",
    customerSecret: "f261c32d6af1406eb9a987f5cc900613",
    functionsAdapter: RuntimeFunctionsAdapter(),
  ),
];

void main() {
  runMasamuneApp(
    masamuneAdapters: masamuneAdapters,
    (adapters) => MasamuneApp(
      home: const AgoraPage(),
      title: "Flutter Demo",
      masamuneAdapters: adapters,
      theme: AppThemeData(
        primary: Colors.blue,
      ),
    ),
  );
}

class AgoraPage extends StatefulWidget {
  const AgoraPage({super.key});

  @override
  State<StatefulWidget> createState() => AgoraPagePageState();
}

class AgoraPagePageState extends State<AgoraPage> {
  final AgoraController _controller = AgoraController("test_channel");

  @override
  void initState() {
    super.initState();
    _controller.addListener(_handledOnUpdate);
  }

  void _handledOnUpdate() {
    setState(() {});
  }

  @override
  void dispose() {
    super.dispose();
    _controller.removeListener(_handledOnUpdate);
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("App Demo"),
      ),
      body: GridBuilder<AgoraUser>.count(
        crossAxisCount: 2,
        source: _controller.value ?? <AgoraUser>[],
        builder: (context, item, index) {
          return AgoraScreen(value: item);
        },
      ),
      floatingActionButton: !_controller.connected
          ? FloatingActionButton(
              onPressed: () {
                _controller.disconnect();
              },
              child: const Icon(Icons.login),
            )
          : FloatingActionButton(
              onPressed: () {
                _controller.connect(userName: "user_name");
              },
              child: const Icon(Icons.logout),
            ),
    );
  }
}
0
likes
140
pub points
40%
popularity

Publisher

verified publishermathru.net

Plug-in for Masamune framework to use Agora.io. Includes support for recording.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

agora_rtc_engine, flutter, katana, masamune, permission_handler, universal_platform

More

Packages that depend on masamune_agora