applyRemoteCommand static method
- RemoteCommand command
Applies a remote command payload.
Implementation
static Future<bool> applyRemoteCommand(RemoteCommand command) async {
switch (command.type) {
case RemoteCommandType.setConfig:
if (command.payload == null) {
return false;
}
await LocusChannels.methods.invokeMethod('setConfig', command.payload!);
return true;
case RemoteCommandType.syncQueue:
await LocusSync.syncQueue();
return true;
case RemoteCommandType.setOdometer:
final value = command.payload?['value'] as num?;
if (value == null) {
return false;
}
await LocusLocation.setOdometer(value.toDouble());
return true;
case RemoteCommandType.resetOdometer:
await LocusLocation.setOdometer(0);
return true;
}
}