webrtc 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 21

webrtc #

p2p vedio

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

0.0.1 #

  • TODO: Describe initial release.


import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:webrtc/webrtc.dart';
import 'webrtc_call.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

enum DialogDemoAction {

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  String _serverAddress;

  void showDemoDialog<T>({BuildContext context, Widget child}) {
      context: context,
      builder: (BuildContext context) => child,
    ).then<void>((T value) {
      // The value passed to Navigator.pop() or null.
      if (value != null) {
        if (value == DialogDemoAction.connect) {
                  builder: (BuildContext context) =>
                      CallSample(ip: _serverAddress)));

  _showAddressDialog(context) {
        context: context,
        child: new AlertDialog(
            title: const Text('Enter server address:'),
            content: TextField(
              onChanged: (String text) {
                setState(() {
                  _serverAddress = text;
              decoration: InputDecoration(
                hintText: _serverAddress,
              textAlign: TextAlign.center,
            actions: <Widget>[
              new FlatButton(
                  child: const Text('CANCEL'),
                  onPressed: () {
                    Navigator.pop(context, DialogDemoAction.cancel);
              new FlatButton(
                  child: const Text('CONNECT'),
                  onPressed: () {
                    Navigator.pop(context, DialogDemoAction.connect);

  void initState() {

  void printLogs() async {
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log")); // default logType
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.WARNING)); // logType = warning
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.ERROR)); // logType = error
    print(await Webrtc.printLog(tag: "Karthik", msg: "This is Test Log", logType: Log.DEBUG)); // logType = debug


  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await Webrtc.platformVersion;
    } 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;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        body: CallSample(ip: "demo.cloudwebrtc.com")

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  webrtc: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:webrtc/webrtc.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Health issues and suggestions

Fix lib/signaling.dart. (-59.88 points)

Analysis of lib/signaling.dart failed with 3 errors, 10 hints, including:

line 230 col 24: Undefined name 'JSON'.

line 355 col 38: Undefined name 'JSON'.

line 356 col 22: Undefined name 'JSON'.

line 1 col 8: Unused import: 'dart:convert'.

line 27 col 10: Name non-constant identifiers using lowerCamelCase.

Fix lib/rtc_data_channel.dart. (-1.99 points)

Analysis of lib/rtc_data_channel.dart reported 4 hints:

line 37 col 10: The value of the field '_label' isn't used.

line 57 col 13: The value of the local variable 'dataChannelId' isn't used.

line 63 col 13: The value of the local variable 'dataChannelId' isn't used.

line 64 col 16: The value of the local variable 'type' isn't used.

Fix lib/rtc_video_view.dart. (-1.99 points)

Analysis of lib/rtc_video_view.dart reported 4 hints:

line 22 col 8: The value of the field '_mirror' isn't used.

line 24 col 25: The value of the field '_objectFit' isn't used.

line 26 col 31: The value of the field '_eventSubscription' isn't used.

line 26 col 31: Cancel instances of dart.async.StreamSubscription.

Fix additional 9 files with analysis or formatting issues. (-1.50 points)

Additional issues in the following files:

  • lib/get_user_media.dart (1 hint)
  • lib/media_stream.dart (1 hint)
  • lib/rtc_peerconnection.dart (1 hint)
  • lib/rtc_dtmf_sender.dart (Run flutter format to format lib/rtc_dtmf_sender.dart.)
  • lib/rtc_ice_candidate.dart (Run flutter format to format lib/rtc_ice_candidate.dart.)
  • lib/rtc_peerconnection_factory.dart (Run flutter format to format lib/rtc_peerconnection_factory.dart.)
  • lib/rtc_session_description.dart (Run flutter format to format lib/rtc_session_description.dart.)
  • lib/rtc_stats_report.dart (Run flutter format to format lib/rtc_stats_report.dart.)
  • lib/webrtc.dart (Run flutter format to format lib/webrtc.dart.)

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Package is getting outdated. (-98.08 points)

The package was last published 103 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.35.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety