Closed agbossi closed 1 year ago
try to alias the typings
import: import 'package:typings/core.dart' as ty;
so it doesn't conflict with other libraries (including the SDK)
That only solves the print error, the connect()
and addEventListener()
still throw the same error
@agbossi as Dart doesn't have method overloading, Typings recreates overloads as accessors:
addEventListener.$1()
addEventListener.$2()
Basically, change your code to use addEventListener.$1(...)
or addEventListener.$2(...)
with the same parameters that it should work.
The reasoning behind this is that it makes the bindings sound.
oooh.. so that's how it should be used. Great now those errors are gone. I updated the relevant lines the following way:
_source.connect.$2(_node);
_mediaRecorder.addEventListener.$2('dataavailable',
_onDataAvailable as ty.EventListenerOrEventListenerObject);
when trying to build, the following happens:
Launching lib/main.dart on Chrome in debug mode...
main.dart:1
Unhandled exception:
Unsupported operation: Undetermined nullability.
Encountered while compiling file:///home/abossi/.pub-cache/hosted/pub.dev/typings-0.0.1+1/lib/src/d/core/lib_es2015_collection_d.dart, which contains the type: InterfaceType(Object%).
lib_es2015_collection_d.dart:1
#0 ProgramCompiler._typeCompilationError (package:dev_compiler/src/kernel/compiler.dart:3355:7)
#1 ProgramCompiler._undeterminedNullabilityError (package:dev_compiler/src/kernel/compiler.dart:3352:7)
#2 ProgramCompiler._emitInterfaceType (package:dev_compiler/src/kernel/compiler.dart:3277:7)
#3 ProgramCompiler.visitInterfaceType (package:dev_compiler/src/kernel/compiler.dart:3191:7)
#4 InterfaceType.accept (package:kernel/ast.dart:12100:42)
#5 MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#6 MappedListIterable.elementAt (dart:_internal/iterable.dart:415:40)
#7 ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#8 InstantiatorGeneratorVisitor.splayNodes (package:dev_compiler/src/js_ast/template.dart:224:23)
#9 InstantiatorGeneratorVisitor.handleCallOrNew.<anonymous closure> (package:dev_compiler/src/js_ast/template.dart:604:22)
#10 Template.instantiate (package:dev_compiler/src/js_ast/template.dart:118:26)
#11 JsBuilder.call (package:dev_compiler/src/js_ast/builder.dart:212:21)
#12 ProgramCompiler._emitGenericClassType (package:dev_compiler/src/kernel/compiler.dart:3393:15)
#13 ProgramCompiler._emitInterfaceType (package:dev_compiler/src/kernel/compiler.dart:3256:17)
#14 ProgramCompiler.visitInterfaceType (package:dev_compiler/src/kernel/compiler.dart:3191:7)
#15 InterfaceType.accept (package:kernel/ast.dart:12100:42)
#16 ProgramCompiler._emitType (package:dev_compiler/src/kernel/compiler.dart:3076:60)
#17 ProgramCompiler._emitArgumentList (package:dev_compiler/src/kernel/compiler.dart:6223:41)
#18 ProgramCompiler._emitMethodCall (package:dev_compiler/src/kernel/compiler.dart:5326:16)
#19 ProgramCompiler.visitInstanceInvocation (package:dev_compiler/src/kernel/compiler.dart:5240:12)
#20 InstanceInvocation.accept (package:kernel/ast.dart:6128:44)
#21 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#22 ProgramCompiler._emitMethodCall (package:dev_compiler/src/kernel/compiler.dart:5325:22)
#23 ProgramCompiler.visitInstanceInvocation (package:dev_compiler/src/kernel/compiler.dart:5240:12)
#24 InstanceInvocation.accept (package:kernel/ast.dart:6128:44)
#25 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#26 ProgramCompiler.visitConditionalExpression (package:dev_compiler/src/kernel/compiler.dart:6598:21)
#27 ConditionalExpression.accept (package:kernel/ast.dart:7420:44)
#28 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#29 ProgramCompiler.visitLet (package:dev_compiler/src/kernel/compiler.dart:6996:16)
#30 Let.accept (package:kernel/ast.dart:9277:44)
#31 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#32 ProgramCompiler.visitLet (package:dev_compiler/src/kernel/compiler.dart:6995:16)
#33 Let.accept (package:kernel/ast.dart:9277:44)
#34 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#35 MappedListIterable.elementAt (dart:_internal/iterable.dart:415:31)
#36 ListIterator.moveNext (dart:_internal/iterable.dart:344:26)
#37 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#38 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#39 new List.of (dart:core-patch/array_patch.dart:47:28)
#40 ListIterable.toList (dart:_internal/iterable.dart:214:7)
#41 ProgramCompiler._visitExpressionList (package:dev_compiler/src/kernel/compiler.dart:4195:40)
#42 ProgramCompiler.visitListLiteral (package:dev_compiler/src/kernel/compiler.dart:6833:20)
#43 ListLiteral.accept (package:kernel/ast.dart:8700:44)
#44 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#45 ProgramCompiler._emitArgumentList (package:dev_compiler/src/kernel/compiler.dart:6232:11)
#46 ProgramCompiler.visitStaticInvocation (package:dev_compiler/src/kernel/compiler.dart:6146:16)
#47 StaticInvocation.accept (package:kernel/ast.dart:7029:44)
#48 ProgramCompiler._visitExpression (package:dev_compiler/src/kernel/compiler.dart:4232:20)
#49 ProgramCompiler.visitReturnStatement (package:dev_compiler/src/kernel/compiler.dart:4794:45)
#50 ReturnStatement.accept (package:kernel/ast.dart:10786:43)
#51 ProgramCompiler._visitStatement (package:dev_compiler/src/kernel/compiler.dart:4141:20)
#52 ProgramCompiler._emitFunctionScopedBody (package:dev_compiler/src/kernel/compiler.dart:4174:18)
#53 ProgramCompiler._emitSyncFunctionBody.<anonymous closure> (package:dev_compiler/src/kernel/compiler.dart:3909:17)
#54 ProgramCompiler._withLetScope (package:dev_compiler/src/kernel/compiler.dart:2593:25)
#55 ProgramCompiler._withCurrentFunction (package:dev_compiler/src/kernel/compiler.dart:3943:18)
#56 ProgramCompiler._emitSyncFunctionBody (package:dev_compiler/src/kernel/compiler.dart:3905:17)
#57 ProgramCompiler._emitFactoryConstructor (package:dev_compiler/src/kernel/compiler.dart:2310:18)
#58 ProgramCompiler._emitJSInteropClassNonExternalMembers (package:dev_compiler/src/kernel/compiler.dart:919:23)
#59 ProgramCompiler._emitClass (package:dev_compiler/src/kernel/compiler.dart:734:31)
#60 List.forEach (dart:core-patch/growable_array.dart:416:8)
#61 ProgramCompiler._emitLibrary (package:dev_compiler/src/kernel/compiler.dart:670:23)
#62 List.forEach (dart:core-patch/growable_array.dart:416:8)
#63 ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:479:15)
#64 IncrementalJavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:217:33)
#65 FrontendCompiler.writeJavaScriptBundle (package:frontend_server/frontend_server.dart:778:46)
<asynchronous suspension>
#66 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:641:9)
<asynchronous suspension>
#67 listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1308:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
Exited (sigterm)
Failed to compile application.
Any ideas about what could be going on?
it seems to be the same error here. It should work in release mode.
What is your Dart version? Are you using Flutter?
Yes Flutter SDK 3.10.6 Dart SDK 3.0.6 (Flutter) I'll try the release mode and update
You are right, it works in release mode. Thank you Out of curiosity, do you think this will be solved in a near future?
yes because the Dart team has been working hard with JS web WASM interop.
Also it helps thumbing up that issue so it can get more attention
Will do, thank you for everything
Hi, I apologize if this is not the place for this kind of issues, but there I found very little information. I have some code in a project that uses js_bindings. Today when working on this project after while I saw that my app doesn't build anymore and that the problem is related to js_bindings dependency, that's when I found it is discontinued, so I'm trying to adapt the code using typings, but I'm having some issues.
here is the most relevant part of the code along with the errors
errors:
Too many positional arguments: 0 expected, but 1 found.
The expression doesn't evaluate to a function, so it can't be invoked
The expression doesn't evaluate to a function, so it can't be invoked.dart[invocation_of_non_function_expression
As I mentioned before, I couldn't find many examples, but from what I understand from the pub.dev documentation, I should be able to use these objects. What am I missing?