altibbi 0.1.0 copy "altibbi: ^0.1.0" to clipboard
altibbi: ^0.1.0 copied to clipboard

Altibbi's Flutter SDK provides real-time, 24/7 connection to certified doctors via a suite of communication channels including GSM, VOIP, chat, and video.

Altibbi Flutter SDK #

This Flutter SDK provides integration for the Altibbi services, including video consultation, text consultation, push notification, and many other features. This guide will walk you through the steps to integrate it into your Flutter project.

Usage #

Initialize the Altibbi service with the user token and partner endpoint as follows:

Note: Be sure to replace placeholders "USER_TOKEN" and "PARTNER_ENDPOINT" with your actual values.

AltibbiService.init(
    token: "USER_TOKEN",
    baseUrl: "PARTNER_ENDPOINT",
    language: "Language", // 'ar' || 'en'
);
copied to clipboard

After Initialize Altibbi Service You Can Use Altibbi API : #

Using the API Service:

ApiService apiService = ApiService();
copied to clipboard

User API #

Create New User :

You Have To Pass User Object

User user =  User(name: "user_name");
var users = await apiService.createUser(user);
copied to clipboard

Get User Info By ID :

var user = await apiService.getUser(user_id);
copied to clipboard

you can pass page && perPage defaults 1 && 20

var users = await apiService.getUsers(perPage: 20, page: 1);
copied to clipboard

Update User Info :

var user = await apiService.updateUser(new_user_info , user_id);
copied to clipboard

Delete User :

var user = await apiService.deleteUser(user_id);
copied to clipboard

Consultation API #

Create Consultation :

var consultation = await apiService.createConsultation(
      question: "user_question",
      medium:  Medium.chat, // there are 4 type of medium (chat,voip,video,gsm)
      userID: 1, //Assigning consultation to User ID
      mediaIDs: media // image,pdf .. 
  );
copied to clipboard

Note That You Can Pass "followUpId" In Case Consultation Is FollowUpConsultation

Consultation List:

you can pass page && perPage defaults 1 && 20

var consultationList = await apiService.getConsultationList(page: 1, perPage: 30);
copied to clipboard

Consultation Info By ID :

var consultation = await apiService.getConsultationInfo(consultation_id);
copied to clipboard

Last Consultation Info :

var consultation = await apiService.getLastConsultation();
copied to clipboard

Delete Consultation :

var value = await apiService.deleteConsultation(consultation_id);
copied to clipboard

Cancel Consultation :

var cancelValue = await apiService.cancelConsultation(consultation_id);
copied to clipboard

Prescription API #

download the Prescription

note : if the prescription for the consultation is generated it will return else it will be null

var prescriptionPath = await apiService.getPrescription(consultation_id,path_to_save_the_file);
copied to clipboard

Media API #

Upload Media That Can Be Used In Consultation (Image , PDF)

var media = await apiService.uploadMedia(image);
copied to clipboard

Use Pusher Service To Listen To Consultation Event #

Initializing the Pusher Service:

Pusher().init(
  onEvent: onEvent, 
  channelName: "pusher_channel_name", // retrun from the consultation api
  apiKey: "pusher_api_key" // retrun from the consultation api
);
copied to clipboard

You Can Listen To Event Using Funtion "onEvent" Passed In Pusher().init :

void onEvent(event) async {
  print("event Name = " + event.eventName);
}
copied to clipboard

Initializing the Video Service && Granted Permission : #


 late VideoConfig _config;
 VideoController? _controller;
  
  
 Future<void> initPlatformState() async {
    _config = VideoConfig(
      apiKey: "apikey",// Get This From The Pusher Event
      sessionId: "sessionId",// Get This From The Pusher Event
      token: "token",// Get This From The Pusher Event
    );

    _controller = VideoController();

    WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
      Map<Permission, PermissionStatus> statuses = await [
        Permission.camera,
        Permission.microphone,
      ].request();
      final isGranted =
          statuses[Permission.camera] == PermissionStatus.granted &&
              statuses[Permission.microphone] == PermissionStatus.granted;
      if (isGranted) {
     
        _controller?.initSession(_config);
        if(widget.voip){
          await Future.delayed(const Duration(seconds: 3), () {
            videoControl(true);
          });
        }
      } else {
        debugPrint(
            "Camera or Microphone permission or both denied by the user!");
      }
    });
  }
copied to clipboard

Displaying Altibbi Video: #

Use VideoView Widget

 VideoView(controller: _controller ?? VideoController()),
copied to clipboard

Initializing Chat: #

Use AltibbiChat Widget

 AltibbiChat().init(consultation: consultation);
copied to clipboard

Chat listeners: #

Assigning Chat listeners

 AltibbiChat().addChannelHandler('myChannelHandler', channelHandler);
copied to clipboard

Sending Chat message: #

Sending a text Chat

 GroupChannel groupChannels = await AltibbiChat().getGroupChannel(consultation);
 groupChannels.sendUserMessage(UserMessageCreateParams(message: message));
copied to clipboard

Example #

An example Flutter application using the Altibbi SDK can be found in the example directory.

Please see the example directory for a complete sample app using Altibbi Flutter SDK.

1- Creating a consultation page
2- Waiting room page
3- Chat page page
4- Video conference page
5- VOIP conference page
6- Crating user page
copied to clipboard

Documentation #

If you need support you can contact: mobile@altibbi.com. Please ensure that you are referencing the latest version of our SDK to access all available features and improvements.

License #

The Altibbi Flutter SDK is licensed under the Altibbi License.

5
likes
150
points
92
downloads

Publisher

verified publisheraltibbi.com

Weekly Downloads

2024.07.05 - 2025.01.17

Altibbi's Flutter SDK provides real-time, 24/7 connection to certified doctors via a suite of communication channels including GSM, VOIP, chat, and video.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, plugin_platform_interface, pusher_channels_flutter, sendbird_chat_sdk

More

Packages that depend on altibbi