sip_ua 0.3.5 copy "sip_ua: ^0.3.5" to clipboard
sip_ua: ^0.3.5 copied to clipboard

outdated

A SIP UA stack for Flutter/Dart, based on flutter-webrtc, support iOS/Android/Destkop/Web.

example/lib/main.dart

import 'package:flutter/foundation.dart'
    show debugDefaultTargetPlatformOverride;

import 'package:flutter/material.dart';
import 'package:sip_ua/sip_ua.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'src/register.dart';
import 'src/dialpad.dart';
import 'src/callscreen.dart';
import 'src/about.dart';

void main() {
  if (WebRTC.platformIsDesktop) {
    debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
  }
  runApp(MyApp());
}

typedef PageContentBuilder = Widget Function(
    [SIPUAHelper helper, Object arguments]);

// ignore: must_be_immutable
class MyApp extends StatelessWidget {
  final SIPUAHelper _helper = SIPUAHelper();
  Map<String, PageContentBuilder> routes = {
    '/': ([SIPUAHelper helper, Object arguments]) => DialPadWidget(helper),
    '/register': ([SIPUAHelper helper, Object arguments]) =>
        RegisterWidget(helper),
    '/callscreen': ([SIPUAHelper helper, Object arguments]) =>
        CallScreenWidget(helper, arguments as Call),
    '/about': ([SIPUAHelper helper, Object arguments]) => AboutWidget(),
  };

  Route<dynamic> _onGenerateRoute(RouteSettings settings) {
    final String name = settings.name;
    final PageContentBuilder pageContentBuilder = routes[name];
    if (pageContentBuilder != null) {
      if (settings.arguments != null) {
        final Route route = MaterialPageRoute<Widget>(
            builder: (context) =>
                pageContentBuilder(_helper, settings.arguments));
        return route;
      } else {
        final Route route = MaterialPageRoute<Widget>(
            builder: (context) => pageContentBuilder(_helper));
        return route;
      }
    }
    return null;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        fontFamily: 'Roboto',
      ),
      initialRoute: '/',
      onGenerateRoute: _onGenerateRoute,
    );
  }
}
122
likes
0
pub points
94%
popularity

Publisher

verified publisherflutter-webrtc.org

A SIP UA stack for Flutter/Dart, based on flutter-webrtc, support iOS/Android/Destkop/Web.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

crypto, flutter_webrtc, intl, logger, parser_error, path, random_string, recase, sdp_transform, uuid

More

Packages that depend on sip_ua