When a method is called on an object, and this method does not exist in its class, or any of its superclasses in the inheritance tree, then noSuchMethod()
from Object
is called. The default behavior of noSuchMethod
is to throw a NoSuchMethodError
, method not found: 'methodname'. However, Dart can do more; as in some other dynamic languages, every class can implement noSuchMethod
to make its behavior more adaptive and flexible. This is because of the fact that Dart is dynamically typed, so it is possible to call a method that does not exist in a dynamic variable. In Java, you get a compile time error for this. In Dart too, an error is thrown but at runtime. By using noSuchMethod()
, we can circumvent this and put it to our use.
DART Cookbook
By :
DART Cookbook
By:
Overview of this book
Table of Contents (18 chapters)
Dart Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Working with Dart Tools
Structuring, Testing, and Deploying an Application
Working with Data Types
Object Orientation
Handling Web Applications
Working with Files and Streams
Working with Web Servers
Working with Futures, Tasks, and Isolates
Working with Databases
Polymer Dart Recipes
Working with Angular Dart
Index
Customer Reviews