Skip to main content

sdk_rtc_flutter 1.0.1+1 copy "sdk_rtc_flutter: ^1.0.1+1" to clipboard
sdk_rtc_flutter: ^1.0.1+1 copied to clipboard

C-iCare SDK Call is a SDK for calling app to app or app to phone

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:sdk_rtc_flutter/sdk_rtc_flutter.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _sdkRtcFlutterPlugin = SdkRtcFlutter();
  final TextEditingController _alertDataController = TextEditingController();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // 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.
    // We also handle the message potentially returning null.
    try {
      platformVersion =
          await _sdkRtcFlutterPlugin.getPlatformVersion() ??
          'Unknown platform version';

      _sdkRtcFlutterPlugin.setAPI("", "");

      _sdkRtcFlutterPlugin.activate();
    } 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) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Running on: $_platformVersion\n'),
              ElevatedButton(
                onPressed: () {
                  print("make call pressed");
                  _sdkRtcFlutterPlugin.makeCall(
                    callerId: '2',
                    calleeId: '13',
                    checkSum: 'asdfasdfasdfasd',
                    metaData: <String, String>{},
                  );
                },
                child: const Text('Button'),
              ),
              SizedBox(height: 20),
              TextField(
                controller: _alertDataController,
                decoration: InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'Alert Data',
                  hintText: 'Input alert data',
                ),
                maxLines: 4,
              ),
              SizedBox(height: 10),
              ElevatedButton(
                onPressed: () {
                  final alertData = _alertDataController.text;
                  _sdkRtcFlutterPlugin.incomingCall(
                    callerId: "callerId",
                    calleeId: "calleeId",
                    checkSum: "checkSum",
                    metaData: {"alert_data": alertData},
                  );
                },
                child: const Text('Incoming Test'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
120
points
2
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

C-iCare SDK Call is a SDK for calling app to app or app to phone

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on sdk_rtc_flutter

Packages that implement sdk_rtc_flutter