In distinction dart flutter dynamic var object of

The difference between dynamic, var, object three types of

dynamic:

All objects dart basis, in most cases, it is not directly defined by its variable type checking is turned off, which means dynamix x = 'hal'; x.foo (); This static type checking will not error, but it will crash when run, because x does not foo () method, it is recommended that you do not directly use the dynamic programming;

where:

It is a keyword, which means "I do not care what type here is that" the system will automatically determine the type runtimeType;

object:

Dart is an object of the base class, when you define: object o = xxx; when this time will be considered o ten objects, you can call the o toString () and hashCode () method because the Object provides these methods, but if you Attempting to call o.foo (), static type checking will run error. To sum up the biggest difference is easy to see the dynamic object is on static type checking.


More Detailed Explanation:
like you can add Q group number: 913 934 649, thumbs up, comment;

Jane book: https://www.jianshu.com/u/88db5f15770d

csdn:https://me.csdn.net/beyondforme

Nuggets: HTTPS: //juejin.im/user/5e09a9e86fb9a016271294a7
**

Published 152 original articles · won praise 18 · views 60000 +

Guess you like

Origin blog.csdn.net/beyondforme/article/details/104109403