BarcodeScanner Encode Method doest not work

I want to create a barcode on my device but when I use Encode method of Barcodscanner I don’t get any thing on my screen and it says " encoded data is not defined ". I spent many hours to find a solution but I didn’t. Can someone who knows the solution help me?

*I have installed all barcode plugins

Here is my code:

import { BarcodeScanner, BarcodeScannerOptions } from ‘@ionic-native/barcode-scanner’;

constructor( private barcode : BarcodeScanner ) {

this.barcode.encode(this.barcode.Encode.TEXT_TYPE,“lol”).then((encodedData) => {
console.log(encodedData);
}, (err) => {
console.log("Error occured : " + err);
});

}

return:

message

“encodedData is not defined”