flutter_ion 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

Flutter sdk for ion #

Flutter sdk for the Ion backend.

Installation #

Edit pubspec.yaml in your flutter projects.


    flutter_ion: ^0.1.1

Usage #

import 'package:flutter_ion/flutter_ion.dart';

var url = 'https://$host:8443/ws';
Client client = Client(url);

// Setup handlers
client.on('peer-join', (rid, id, info) async {});

client.on('peer-leave', (rid, id) async {});
client.on('transport-open', () {}));

client.on('transport-closed', () {});

client.on('stream-add', (rid, mid, info, tracks) async {
      // handle stream-add

client.on('stream-remove', (rid, mid) async {
      // handle stream-remove
client.on('broadcast', (rid, uid, info) async {
      // handle broadcast

// Connect to ion biz node.
await client.connect();

// Join a room
await _client.join(rid, {'name': 'Bob'});

// Leave current room
await client.leave();

// Publish local stream
var resolution = 'vga';
var bandwidth =  '512';
var codec = 'vp8';
var localStream = await client.publish(true, true, false, codec, bandwidth, resolution);

// Subscribe to a remote stream
var bandwidth = '512';
var remoteStream = await client.subscribe(rid, mid, tracks, bandwidth);

// Broadcast a payload to the room
client.broadcast(rid, payload);

// Close client connection
await client.close();

Changelog #

[0.1.2] - 2020.06.02

  • Bug fixes.

[0.1.1] - 2020.05.09

  • Make sdk cleaner.

[0.1.0] - 2020.05.09

  • Initial release.


import 'package:flutter/material.dart';

void main() {

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      home: MyHomePage(title: 'Flutter Demo Home Page'),

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.

  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
              'You have pushed the button this many times:',
              style: Theme.of(context).textTheme.headline4,
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.

Use this package as a library

1. Depend on it

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

  flutter_ion: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_ion/flutter_ion.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 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Health issues and suggestions

Fix lib/src/utils_web.dart. (-25 points)

Analysis of lib/src/utils_web.dart failed with 1 error:

line 5 col 8: The method 'addTransceiver' isn't defined for the type 'RTCPeerConnection'.

Document public APIs. (-1 points)

38 out of 38 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/client.dart. (-1 points)

Analysis of lib/src/client.dart reported 2 hints:

line 211 col 11: Name non-constant identifiers using lowerCamelCase.

line 324 col 11: The value of the local variable 'rtx' isn't used.

Fix lib/src/logger.dart. (-1 points)

Analysis of lib/src/logger.dart reported 2 hints:

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

line 3 col 26: Use ; instead of {} for empty constructor bodies.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/flutter_ion.dart (Run flutter format to format lib/flutter_ion.dart.)
  • lib/src/stream.dart (Run flutter format to format lib/src/stream.dart.)
  • lib/src/utils.dart (Run flutter format to format lib/src/utils.dart.)

Maintenance issues and suggestions

No valid SDK. (-20 points)

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

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 Constraint Resolved Available
Direct dependencies
Dart SDK >2.2.0 <3.0.0
events2 ^0.1.3 0.1.3
flutter_webrtc ^0.2.8 0.2.8
protoo_client ^0.3.0 0.3.0
sdp_transform ^0.2.0 0.2.0
uuid ^2.0.1 2.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
flutter 0.0.0
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8