flutter_smart_ptt 1.0.3 copy "flutter_smart_ptt: ^1.0.3" to clipboard
flutter_smart_ptt: ^1.0.3 copied to clipboard

smart-ptt

A intercom library that includes functions such as logging in, logging out, entering groups, exiting groups, making temporary calls, monitoring groups, canceling monitoring groups, sending and receiving messages, etc

Create object #

FlutterSmartPtt _flutterSmartPttPlugin = FlutterSmartPtt();

###Set language _flutterSmartPttPlugin.setLanguage("en"); Supported parameters:en、es、fa、fr、it、ja、ko、pt、ru、tr、uk、zh

Monitor data updates for intercom #

PocChangeNotifier pocChangeNotifier = _flutterSmartPttPlugin.getPocChangeNotifier(); pocChangeNotifier.addListener(() { ... pocChangeNotifier.xxx ... });

Field Definition Comment
int _id id
String _account Account
String _password Password
String _name Name
int _status Status
int _privilege Privilege
List<dynamic> _groups List of all groups
Map groupsMap Map of all groups
Map usersMap All users (if a user is in multiple groups, the user object from the last group will be saved)
int _activeGroupId Current group ID, 0 indicates not in any group
bool _isRecording Whether recording is in progress
bool _isPlaying Whether playing is in progress
String _speakingName Name of the current speaker
List<int> _speakingIdList List of IDs of the current speakers
bool _hideTalker Hide the speaker
int _offlineCode Offline code, -1: normal exit
bool _isOnline Whether online
String _activeGroupName Name of the current group
dynamic _showGroup Group showing the current members
int _showGroupId ID of the group showing the current members
final List<int> _monitoredGroupIds List of monitored group IDs
int _gpsInterval GPS interval
String _location Location

Monitor data updates for settings #

SettingChangeNotifier settingChangeNotifier = _flutterSmartPttPlugin.getSettingChangeNotifier(); settingChangeNotifier.addListener(() { ... settingChangeNotifier.xxx ... });

Field Definition Comment
bool _enable8KCoding Enable 8K coding
bool _enablePTT Enable PTT
bool _enableToast Whether to enable toast notifications
bool _enableVoiceBroadCast Whether to enable voice broadcast
bool _enableBeep Whether to enable beep sounds
bool _enableLog Whether to enable logging

Set server address #

_flutterSmartPttPlugin.setUrl(url);

Server Address List: https://corget.com/flutter/url.txt

Login #

_flutterSmartPttPlugin.login(account, password);

Logout #

_flutterSmartPttPlugin.logout();

Start speaking #

_flutterSmartPttPlugin.startPTT();

End speaking #

_flutterSmartPttPlugin.endPTT();

Enter a group based on the group ID #

_flutterSmartPttPlugin.enterGroup(groupId);

Enter the previous group #

_flutterSmartPttPlugin.enterPreGroup();

Enter the next group #

_flutterSmartPttPlugin.enterNextGroup();

Exit the current group #

_flutterSmartPttPlugin.leaveGroup();

Monitor a group based on its ID #

_flutterSmartPttPlugin.addMonitorGroup(groupId);

Cancel monitor a group based on its ID #

_flutterSmartPttPlugin.removeMonitorGroup(groupId);

Send an SOS alert message to the current group. If not currently in the group, send it to the first group #

_flutterSmartPttPlugin.sos();

Temporary call to one or more users #

_flutterSmartPttPlugin.inviteTmpGroup(userIdList);

Pull one or more users into the current group #

_flutterSmartPttPlugin.pullUsersToGroup(userIdList);

Remove one or more users from the current group #

_flutterSmartPttPlugin.disJoinUser(userIdList);

Remove one or more users from the current group #

_flutterSmartPttPlugin.pullUsersToGroup(userIdList);

Make one or more users unable to log in #

_flutterSmartPttPlugin.forceUserExit(userIdList);

Send a message to a group based on the group ID #

_flutterSmartPttPlugin.sendGroupMsg(...);

Send a message to a user based on their ID #

_flutterSmartPttPlugin.sendUserMsg(...);

Modify Setting #

_flutterSmartPttPlugin.enablePTT(true);

_flutterSmartPttPlugin.enablePTT(false);

_flutterSmartPttPlugin.enable8KCoding(false);

_flutterSmartPttPlugin.enable8KCoding(true);

_flutterSmartPttPlugin.enableToast(true);

_flutterSmartPttPlugin.enableToast(false);

_flutterSmartPttPlugin.enableVoiceBroadCast(true);

_flutterSmartPttPlugin.enableVoiceBroadCast(false);

_flutterSmartPttPlugin.enableBeep(true);

_flutterSmartPttPlugin.enableBeep(false);

_flutterSmartPttPlugin.enableLog(true);

_flutterSmartPttPlugin.enableLog(false);

Set callback method #

_flutterSmartPttPlugin.smartPttMethodCall(handleMethodCall);

You can handle callback methods according to your needs

For example, when you receive a text message sent by someone else, you will receive a callback method named "NotifyMsg"

Customize translation content #

Key value pairs for translation:https://corget.com/flutter/intl_en.arb.txt

Return custom translation content to the specified translation key, such as:

dynamic handleMethodCall (MethodCall methodCall) {

String method = methodCall.method;
dynamic arguments = methodCall.arguments;
switch (method) {
  case "getTranslation":
    String key=methodCall.arguments;
    if(key=="Speaking"){
      return "is currently speaking,release to end.";
    }
    break;
}

}

Location #

Attention points here:https://pub.dev/packages/geolocator