How to change type of variable from Future<Uin8List> to Uint8List in Flutter?

220 Views Asked by At
  static Future<dynamic> variance_of_laplacian(Uint8List image){
    return ImgProc.laplacian(image, 64);
  }

  static Future<Bool> isBlur(Uint8List byteData) {
    Future<Uint8List> gray = ImgProc.cvtColor(byteData, colorBGR2GRAY);

    
    Future<dynamic> fm = variance_of_laplacian(gray);
  }

There is an error in last line when I pass gray to variance_of_laplacian function because both have different variable type i.e. Future<Uint8List> and Uint8List. How can I resolve this?

1

There are 1 best solutions below

0
umuieme On

you can use await to resolve and get the value from the future.

static Future<Bool> isBlur(Uint8List byteData) async {
    Uint8List gray = await ImgProc.cvtColor(byteData, colorBGR2GRAY);

    
    Future<dynamic> fm = variance_of_laplacian(gray);
  }