dyte_client 0.8.14 copy "dyte_client: ^0.8.14" to clipboard
dyte_client: ^0.8.14 copied to clipboard

discontinuedreplaced by: dyte_core
PlatformAndroidiOS

Integrate dyte video calls in your apps. This package exposes a widget that helps integrate native dyte meeting UI in a flutter app

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:dyte_client/dyte.dart';
import 'package:dyte_client/dyteMeeting.dart';
import 'package:dyte_client/dyteParticipant.dart';
import 'package:dyte_client/dyteSelfParticipant.dart';
import 'package:dyte_client/mobile_flutter.dart';
import 'dart:math';
import 'dart:async';
import 'package:flutter/services.dart';

void main() {
  runApp(MaterialApp(home: FirstRoute()));
}

class FirstRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('First Route'),
      ),
      body: Center(
        child: ElevatedButton(
          child: Text('Open route'),
          onPressed: () {
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => MyApp()),
            );
          },
        ),
      ),
    );
  }
}

class MyApp extends StatefulWidget {

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
    String _platformVersion = 'Unknown';
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

    Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      platformVersion =
          await MobileFlutter.platformVersion ?? 'Unknown platform version';
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width;
    double height = MediaQuery.of(context).size.height;
    var rng = new Random();
    var i = rng.nextInt(100);
    return Scaffold(
      body: Row(
        // <Widget> is the type of items in the list.
        children: <Widget>[
          SizedBox(
              width: width,
              height: height,
              child: DyteMeeting(
                roomName: "zanjly-cfosgd",
                authToken: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImVmNDAzZjg4LWNkODItNDI1NC1iZTJiLWE1ZmE5NDI2MjhkMSIsImxvZ2dlZEluIjp0cnVlLCJpYXQiOjE2NzY1NjYxMzIsImV4cCI6MTY4NTIwNjEzMn0.AZrz01-mLkRqYSABW6qIJvpOj5jb0qY2gFkaedQzBC85caMKC2k2PY_jrCAnm3JSuIwPkLi_8IOQAT5wQWVumuNfmRFPlDvRjcdpFSFCOu8hznFHd1UoLoPDzNqH6hUHWCNprS7jd0MWcwgQPLr6jHdUqBay09LjCj4gNToGbcimKlVur2HT3ZaC1-RBYLZiAyKwaZrP7wwf4-r0vRQLEQNV3vxjqHDe8I1nDa2mkpLaDljAZkTp5ywkHadW0fbSB01hrFuIzBLR89Dr9FpUlRnvbGmfOPm6VHx2W3000Bih1bjy2yi0yESxidc5Ew2gX2-5HBfAUYpCvYAY85-bmw",
                useHybridComposition: true,
                showSetupScreen: true,
                onInit: (DyteMeetingHandler meeting) async { 
                  meeting.events.on('meetingEnd', this, (a, b) {
                    print(i.toString() + "event-meetingEnd");
                    Navigator.push(
                      context,
                      MaterialPageRoute(builder: (context) => FirstRoute()),
                    );
                  });
                  meeting.events.on('meetingDisconnected', this, (a, b) {
                    print(i.toString() + "event-meetingDisconnected");
                  });
                  meeting.events.on('meetingJoin', null, (a, b) async {
                    print(i.toString() + "event-meetingJoin");
             
                  });
                  meeting.events.on('meetingConnected', this, (a, b) {
                    print(i.toString() + "event-meetingConnected");
                  });
                },
              ))
        ],
      ),
    );
  }
}
7
likes
100
pub points
86%
popularity

Publisher

verified publisherdyte.io

Integrate dyte video calls in your apps. This package exposes a widget that helps integrate native dyte meeting UI in a flutter app

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

eventify, flutter

More

Packages that depend on dyte_client