setFilter method

Future<int?> setFilter(
  1. String assetUrl

Specify material filter effect


assetUrl can be an asset resource address defined in Flutter such as 'images/watermark_img.png' or an online image address

Note: PNG format must be used

Platform not supported:

  • web
  • Windows


Future<int?> setFilter(String assetUrl // Resource address in `assets`
    ) async {
  String imageUrl = assetUrl;
  String type = 'network'; // Online image by default
  if (assetUrl.indexOf('http') != 0) {
    type = 'local';
  return _channel
      .invokeMethod('setFilter', {"imageUrl": imageUrl, "type": type});