Outgoing Call

The StreamCallContainer widget offers built-in support for displaying outgoing calls. When you initiate a new ringing-flow call, you can pass it to the StreamCallContainer, and the outgoing call screen will be shown until the first participant joins the call.

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

// Example method called to create a new call
Future<void> startCall() {
    final call = StreamVideo.instance.makeCall(
      callType: StreamCallType.defaultType(),
      id: {CALL_ID},
    );

    final result = await call.getOrCreate(
      ringing: true,
      video: true,
      memberIds: [
        'user1',
        'user2',
      ],
    );

    result.fold(
      success: (success) {
        if (mounted) {
          Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => MyCallScreen(call)),
            );
        }
      },
      failure: (failure) {
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            content: Text('Error: ${failure.error.message}'),
          ),
        );
      },
    );
}

class MyCallScreen extends StatelessWidget {
    const MyCallScreen(this.call, {super.key});

    final Call call;
    
    @override
    Widget build(BuildContext context) {
        return StreamCallContainer(
            call: call,
        );
    }
}

Preview of Outgoing Call Screen

Customization

You can customize how the outgoing call screen looks by providing you own widget:

StreamCallContainer(
    call: call,
    outgoingCallBuilder: (context, call, callState) {
        return MyOwnOutgoingCallScreen(call: call);
    },
)
© Getstream.io, Inc. All Rights Reserved.