MethodChannelFlutterTuyaSdk class

The MethodChannel implementation of FlutterTuyaSdkPlatform.

Inheritance

Properties

hashCode → int
The hash code for this object.
no setterinherited
methodChannel → MethodChannel
The MethodChannel used to talk to the native side.
final
remoteUnlockEventStream → Stream<Map<String, dynamic>>?
Stream for remote unlock requests
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDeviceToRoom({required int homeId, required int roomId, required String devId}) → Future<void>
Add a given device to a room homeId,roomId,devId details are passed on to native addDeviceToRoom function of native is invoked
override
addGroupToRoom({required int homeId, required int roomId, required int groupId}) → Future<void>
Add a group to a given room homeId,roomId,groupId details are passed on to native addGroupToRoom function of native is invoked
override
addRoom({required int homeId, required String roomName}) → Future<void>
Add a room to a home homeId,roomName details is passed on to native addRoom function of native is invoked
override
checkIfMatter({required String devId}) → Future<bool>
Check if a device is matter device or not devId details is passed on to native checkIfMatter function of native is invoked
override
checkLogin() → Future<bool>
Login with email. Checks if any user is logged in currently. checkLogin function on the native side is invoked returns true if logged in and false if not logged in
override
connectDeviceAndQueryWifiList({required int timeout}) → Future<void>
Connects to device AP and queries Wi-Fi networks (AP+ flow). timeout data is passed on to native
override
controlMatter({required String devId, required Map<String, dynamic> dps}) → Future<void>
Send dps configuration to control the wifi device devId,dps details are passed on to native controlMatter function of native is invoked
override
createHome({required String name, String? geoName, List<String>? rooms, double? latitude, double? longitude}) → Future<int>
Creates a new home. name,geoName,rooms,latitude,longitude details are passed on to the native createHome function of the native is invoked Returns the new home ID.
override
deleteAccount() → Future<void>
Deletes the current user account. deleteAccount function on the native side is invoked
override
deleteDevice({required String devId}) → Future<void>
Delete/unbind a specific device. This calls the native deleteDevice handler which in turn calls the Tuya SDK removeDevice.
override
deleteHome({required int homeId}) → Future<void>
Deletes a home by ID. homeId is passed on to the native deleteHome function of native is invoked
override
discoverDeviceInfo() → Future<Map<String, dynamic>?>
Scans for the first inactivated BLE device advertising Tuya packets. discoverDeviceInfo function in native is invoked Returns its raw JSON map, or null if none found.
override
dynamicWifiLockPassword({required String devId}) → Future<String>
Get a dynamic password for opening a wifi lock devId details is passed on to native dynamicWifiLockPassword function of native is invoked
override
getCurrentUser() → Future<Map<String, dynamic>>
Get the current user’s info. Throws if no user is logged in. getCurrentUser function on the native side is invoked returns a map with all the user details
override
getHomeDevices({required int homeId}) → Future<List<Map<String, dynamic>>>
Gets all devices for the given homeId. homeId is passed on to the native getHomeDevices function of native is invoked returns the list of devices
override
getHomeList() → Future<List<Map<String, dynamic>>>
Retrieves a list of all homes. getHomeList function of the native is invoked returns the list of homes
override
getPlatformVersion() → Future<String?>
Calls a method o────────────────────────────────────────────────────────── Returns the platform version, e.g. "iOS 18.5" or "Android 12".
override
getRoomList({required int homeId}) → Future<List<Map<String, dynamic>>?>
Get rooms details for a home homeId is passed on to native getRoomList function of native is invoked returns JSON map
override
getSSID() → Future<String?>
Retrieves the current Wi-Fi SSID getSSID function of the native is invoked returns the ssid
override
getToken({required int homeId}) → Future<String?>
Retrieves a pairing token for the given homeId. homeId is passed on to native getToken function of the native is invoked token of the home is returned
override
initDevice({required String devId}) → Future<void>
Init the device devId is passed on to native initDevice function on native is invoked
override
lockBLELock({required String devId}) → Future<void>
Lock a bluetooth lock device devId details is passed on to native lockBLELock function of native is invoked
override
lockWifiLock({required String devId}) → Future<void>
lockWifiLock function of native is invoked
override
loginWithEmail({required String countryCode, required String email, required String password, required bool createHome}) → Future<Map<String, dynamic>>
Login with email. countryCode,email,password,createHome details are passed on to the native loginWithEmail function on the native side is invoked
override
loginWithUid({required String countryCode, required String uid, required String password, required bool createHome}) → Future<Map<String, dynamic>>
Login (or register) with UID. countryCode,uid,password,createHome details are passed on to the native loginWithUid function on the native side is invoked
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pairBleDevice({required String uuid, required String productId, required int homeId, int? deviceType, String? address, int? flag, int? timeout}) → Future<Map<String, dynamic>?>
Activate (pair) a pure-BLE device with the cloud. uuid,productId,homeId,deviceType,address details is passed on to native pairBleDevice function on native is invoked Returns a JSON map
override
queryDeviceInfo({required String devId, List<String>? dps}) → Future<Map<String, dynamic>?>
Query information about a device devId,dps details are passed on to native queryDeviceInfo function of native is invoked
override
queryDeviceWiFiStrength({required String devId}) → Future<String?>
Get the signal strength of a specific device devId is passed on to native queryDeviceWifiStrength function of native is invoked String is returned
override
querySubDeviceList({required String devId}) → Future<Map<String, dynamic>?>
Query details of any sub devices devId is passed on to native querySubDeviceList function of native is invoked returns a JSON map
override
registerAccountWithEmail({required String countryCode, required String email, required String password, required String code}) → Future<Map<String, dynamic>>
countryCode, email, password, code details are passed to the native implementation registerAccountWithEmail function on the native side is invoked
override
registerAccountWithPhone({required String countryCode, required String phone, required String password, required String code}) → Future<Map<String, dynamic>>
Register a new account with phone. countryCode, phone, password, code details are passed to the native implementation registerAccountWithPhone function on the native side is invoked
override
removeDevice({required String devId}) → Future<void>
Remove a specific device devId is passed on to native removeDevice function of native is invoked
override
removeDeviceFromRoom({required int homeId, required int roomId, required String devId}) → Future<void>
Remove device from a given room homeId,roomId,devId details are passed on to native removeDeviceFromRoom function on native is invoked
override
removeGroupFromRoom({required int homeId, required int roomId, required int groupId}) → Future<void>
Remove a group from a given room homeId,roomId,groupId details are passed on to native removeGroupFromRoom function of native is invoked
override
removeRoom({required int homeId, required int roomId}) → Future<void>
Remove room from a home homeId,roomId details are passed on to native removeRoom function of native is invoked
override
renameDevice({required String devId, required String name}) → Future<void>
Rename a specific device devId,name details are passed on to native renameDevice function of native is invoked
override
replyRemoteUnlock(String devId, bool allow) → Future<void>
Replies to a remote unlock request
override
restoreFactoryDefaults({required String devId}) → Future<void>
Restore factory defaults for a specific device devId is passed on to native restoreFactoryDefaults function of native is invoked
override
resumeAPPlus({required String ssid, required String password, required String token, required int timeout}) → Future<void>
Completes AP+ pairing with SSID/password/token. ssid,password,token,timeout details are passed on to native resumeAPPlus function in native is invoked
override
sendVerificationCode({required String countryCode, required String account, required String accountType, int? type}) → Future<void>
Sends a verification code to an email address or phone number. accountType can be "email" or "phone". When type is omitted the native SDK defaults to the registration verification flow.
override
setRemoteUnlockListener(String devId) → Future<void>
Sets the remote unlock listener for a specific device
override
smartBlePairing({required int homeId, int timeoutSeconds = 30}) → Future<Map<String, dynamic>?>
Performs a single-device smart BLE pairing flow on the native side. Returns the paired device info map on success, or null on timeout/failure.
override
sortRooms({required int homeId, required List<int> roomIds}) → Future<void>
Sort the order of rooms in a home homeId,roomIds details are passed on to native sortRooms function of native is invoked
override
startComboPairing({required String uuid, required String productId, required int homeId, required String ssid, required String password, int? timeout, int? deviceType, String? address, String? token, int? flag}) → Future<Map<String, dynamic>?>
Start combo (BLE→Wi-Fi) pairing for a device. uuid,productId,homeId,ssid,password,timeout,deviceType,address,token details is passed on to native startComboPairing function of native is invoked returns a JSON map
override
startConfigWiFi({required String mode, required String ssid, required String password, required String token, required int timeout}) → Future<Map<String, dynamic>?>
Starts EZ or AP Wi-Fi pairing. mode,ssid,password,token,timeout details are passed on to native startConfigWifi function of native is invoked
override
stopAnyPairingOrScan() → Future<void>
Stop any ongoing pairing/scan happening on the native side.
override
stopConfigWiFi() → Future<void>
Stops any ongoing Wi-Fi pairing. stopConfigWifi function on native is invoked
override
toString() → String
A string representation of this object.
inherited
tuyaSdkInit({required String appKey, required String appSecret, required bool isDebug}) → Future<void>
Perform native-side initialization of the Tuya SDK. appKey and appSecret must match the current platform. tuyaSdkInit function in the native code (Java/Swift) is called
override
unlockBLELock({required String devId}) → Future<void>
Unlock a bluetooth lock device devId details is passed on to native unlockBLELock function of native is invoked
override
unlockWifiLock({required String devId, required bool open}) → Future<void>
Reply to a unlock request on wifi lock devId,open details are passed on to native unlockWifiLock function of native is invoked
override
updateHomeInfo({required int homeId, required String homeName, String? geoName, double? latitude, double? longitude}) → Future<void>
Updates home information. homeId,homeName,geoName,latitude,longitude details are passed on to the native updateHomeInfo function of native is invoked
override
updateLocation({required double latitude, required double longitude}) → Future<void>
Updates the user’s location latitude,longitude is passed on native updateLocation function on native is invokced
override
updateNickname({required String nickname}) → Future<void>
Updates the current user’s nickname. nickname is passed on to the native updateNickname function of the native is invoked
override
updateRoomName({required int homeId, required int roomId, required String roomName}) → Future<void>
Update the name of a given room homeId,roomId,roomName details are passed on to native updateRoomName function of native is invoked
override
updateTempUnit({required int tempUnit}) → Future<void>
Changes the user’s temperature unit preference. tempUnit is passed on to the native updateTempUnit function of the native is invoked
override
updateTimeZone({required String timeZoneId}) → Future<void>
Updates the user’s time zone. timeZoneId is passed on to the native updateTimeZone function of the native is invoked
override
userLogout() → Future<void>
userLogout function on the native side is invoked
override
wifiBleComboConfig({required String ssid, required int homeId, String? password, String? token, String? productId, String? uuid, int? scanTimeout, int? timeout}) → Future<Map<String, dynamic>?>
Wi-Fi + BLE combo configuration pairing (automatic flow). Automatically scans for combo devices and pairs the first match.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited