changeNavigationIcon method
Implementation
Future<bool?> changeNavigationIcon({
required String imagePath,
double? width,
double? height,
}) async {
Map<String, dynamic> args = {};
try {
ByteData data = await rootBundle.load(imagePath);
if (Platform.isAndroid) {
var bytes =
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
args['imageBytes'] = bytes;
} else if (Platform.isIOS) {
var base64String = base64Encode(
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes));
args['imageBase64'] = base64String;
}
args['width'] = width;
args['height'] = height;
log(args.toString());
} catch (e) {
return false;
}
final result = await _methodChannel.invokeMethod(
MethodChannelEvent.changeNavigationIcon, args);
if (result is bool) return result;
return result;
}