Sometimes, the <script src=".../vue.js"></script> may be forgot or invalid, and the _vue is null. But when running, the error message may be very misleading, which is like:
VM127:1 Uncaught Unhandled exception:
Not a valid JS object
#0 JsNative.callConstructor (dart:js:1461)
#1 callConstructor (dart:js_util:40)
#2 VueAppBase.create (package:vue2/vue.dart:347:5)
#3 new App (http://localhost:8080/index.dart:6:31)
#4 main (http://localhost:8080/index.dart:54:13)
<asynchronous suspension>
#5 main (http://localhost:8080/index.initialize.dart:11:10)
Which took me more than 1 hour to find the real reason.
So I think we'd better to check the _vue when getting it, to make sure it's not null.
I changed the code, could you help to review it? I'm new to dart, not sure if there is better way to do it.
Sometimes, the
<script src=".../vue.js"></script>
may be forgot or invalid, and the_vue
is null. But when running, the error message may be very misleading, which is like:Which took me more than 1 hour to find the real reason.
So I think we'd better to check the
_vue
when getting it, to make sure it's not null.I changed the code, could you help to review it? I'm new to dart, not sure if there is better way to do it.