Navaron Bracke

format barcode reader base

@@ -42,19 +42,20 @@ abstract class BarcodeReader { @@ -42,19 +42,20 @@ abstract class BarcodeReader {
42 42
43 final Completer<void> completer = Completer(); 43 final Completer<void> completer = Completer();
44 44
45 - final HTMLScriptElement script = (document.createElement('script') as HTMLScriptElement)  
46 - ..id = scriptId  
47 - ..async = true  
48 - ..defer = false  
49 - ..type = 'application/javascript'  
50 - ..lang = 'javascript'  
51 - ..crossOrigin = 'anonymous'  
52 - ..src = scriptUrl  
53 - ..onload = allowInterop((JSAny _) {  
54 - if (!completer.isCompleted) {  
55 - completer.complete();  
56 - }  
57 - }).toJS; 45 + final HTMLScriptElement script =
  46 + (document.createElement('script') as HTMLScriptElement)
  47 + ..id = scriptId
  48 + ..async = true
  49 + ..defer = false
  50 + ..type = 'application/javascript'
  51 + ..lang = 'javascript'
  52 + ..crossOrigin = 'anonymous'
  53 + ..src = scriptUrl
  54 + ..onload = allowInterop((JSAny _) {
  55 + if (!completer.isCompleted) {
  56 + completer.complete();
  57 + }
  58 + }).toJS;
58 59
59 script.onerror = allowInterop((JSAny _) { 60 script.onerror = allowInterop((JSAny _) {
60 if (!completer.isCompleted) { 61 if (!completer.isCompleted) {
@@ -65,7 +66,8 @@ abstract class BarcodeReader { @@ -65,7 +66,8 @@ abstract class BarcodeReader {
65 const MobileScannerException( 66 const MobileScannerException(
66 errorCode: MobileScannerErrorCode.genericError, 67 errorCode: MobileScannerErrorCode.genericError,
67 errorDetails: MobileScannerErrorDetails( 68 errorDetails: MobileScannerErrorDetails(
68 - message: 'Could not load the BarcodeReader script due to a network error.', 69 + message:
  70 + 'Could not load the BarcodeReader script due to a network error.',
69 ), 71 ),
70 ), 72 ),
71 ); 73 );
@@ -81,7 +83,10 @@ abstract class BarcodeReader { @@ -81,7 +83,10 @@ abstract class BarcodeReader {
81 /// 83 ///
82 /// The [options] are used to configure the barcode reader. 84 /// The [options] are used to configure the barcode reader.
83 /// The [containerElement] will become the parent of the video output element. 85 /// The [containerElement] will become the parent of the video output element.
84 - Future<void> start(StartOptions options, {required HTMLElement containerElement}) { 86 + Future<void> start(
  87 + StartOptions options, {
  88 + required HTMLElement containerElement,
  89 + }) {
85 throw UnimplementedError('start() has not been implemented.'); 90 throw UnimplementedError('start() has not been implemented.');
86 } 91 }
87 92