Mastering DartDirectory
- 1 Basic
- 2 Advanced Technology/Reflection
- 3 Object Creation
- 4 Asynchronous Programming
- 5 Stream Frame
- 6 Collection Frame
- 7 Dart and JavaScript interoperate
- 8 Internationalization and Localization
- 9 c/S communication
- Ten Premium Storage
- One supports other HTML5 features
- A Safety
Basic
- Modular
- Pubspec.yaml
- Import ' dart:html ' as DOM;
- Custom: _ prefix stands for private
- Import ' Animation.dart ' as animation hide animation; Does it seem that the code directly affects the IDE's autocomplete?
- The DART function can be thought of as JS minus the useless function keyword?
- void Main () {...}
- Introduced a PHP string template: Print ("Result=#{result}");
- Function Shorthand: Sub (A, b) = A-A; ES6 Direct support?
- Class and Mixin
- Strange constructor parameter notation: Car (This.color, this.carrying);
- Abstract (abstraction base class is interface)
- Extends/implements
- Mixin is a special class that uses the WITH keyword to mix with the target class, conditions:
- No (declared) constructor
- No super Class (or object).
- Does not contain a call to Super
- static const List L = const [' A ', ' B ', ' C '];
Advanced Technology/Reflection
- Generic type
- Function: Defines the class of the Call method (vs C + + functions object?). )
- Error vs Exception (recoverable)
- try {...} on Error catch (ex) {...}
- Annotations
- @deprecated
- @override
- @proxy
- Proxy class: @override Nosuchmethod (invocation invo) {...}//borrowed the idea of Ruby?
- Customization: (eh?) It seems to be the normal class)
- Reflection
- Mirrors:classmirror Methodmirror
- 3 main methods: Reflect Reflectclass Reflecttype
- Dynamic invocation: Class MethodInvoker implements Function {call
-
(Methodmirror method) {
-
Cl Assmirror C = Method.owner as Classmirror;
-
Instancemirror Inst = c.newinstance (new Symbol (
), []);
-
Inst.invoke (Method.simplename, []);//syntax for reference to Java;
Object Creation
- Optional {position, name} parameter: Car ([this.color= ' W ', this.weight=1000]); /Car ({this.color: ' W ', this.weight:1000});
- Named construct: Car.fromiem (String Item) {...}//actually not the factory method in C + +
- REDIRECT Construction (inexplicably, it's not just the implementation of the constructor calling another constructor)
- Does dart draw on the member initialization list syntax of C + +?
- Private construction: Car._ ();
- Factory Construction: The abstract factory design pattern is actually used here
- abstract class Log { factory log () {return new ConsoleLog ();} ...}
- Constant Construction: const-Qualified, enum-class?
- Variables must be initialized before they are used? Type ' Null ' is not a subtype of type ' Boolean expression '.
- Is the assignment null?
- Cascading calls:. (This syntax is ugly, I can't stand it)
Asynchronous Programming
- Call stack vs event driver
- future
- new File (' A.txt '). Open (). then (processfile);
- processfile (randomaccessfile file) {file.length (). then (int len) {file.read (len). Then (ReadFile). Whencomplete ( ... ) }); }
- catcherror
- mirotask: Precedence over event is Event-loop execution
- deferred: New future.delayed (New Duration (seconds : 1), computation). Then (ret) =>print (ret));
- Zones
- A configurable execution context for handling asynchronous tasks and Uncaught Exceptions: runzoned (() {...}, OnError: (e) {...});
- zonevalues: ...
- zonespecification: ...
- overload run to track the execution of the zone:
- Print: (zone self, zonedelegate parent, Zone Zone, String msg) {...}, run: (Zone Self, zonedelegate Parent, Zone zone, f) = = run (parent, Zone, F, timer)//The code here is a bit hard to understand, like the difference between self and Zone?
- isolates: Can be thought of as a separate process (no data sharing, only message communication via replication)
- code slightly ... Concurrent: 24000 requests per second??
Stream Frame
- New File (). OpenRead (). pipe (Request.response);
- Single subscription vs broadcast
- Stream class (a bit of LINQ flavor)
- Verification method: Any every contains
- Search: Firstwhere lastwhere singlewhere
- Filter: Where Skip Skipwhere take Takewhere
Next (stream is nothing more than the application of inert sequences in FP)
Collection Frame
- The Lazy iterable (This example seems inappropriate?) )
- Splaytreeset? (Heck, TreeSet in Java is also implemented with splay trees)
- Unmodifiable collection: Not a immutable collection in Scala, just a run-time system at the API level
Dart and JavaScript interoperate
- With Jquery:jproxy
- Dart:js
- The example of performance testing is very lame, and I seriously doubt the true implementation of the following statement: container.appendhtml (' Test ');
Internationalization and Localization
- Intl Library
c/S communication
- Dart:io HttpClient
- Dart:html divelement?
- Ajax polling (this is a bit outdated, not directly with WebSocket?)
- SSE (Tooold)
- WebSocket (TCP-based, but using HTTP to complete the handshake)
Premium Storage
- Cookies
- Web Storage
- Web SQL
- Indexddb
supports other HTML5 features
- Notice
- Native drag and drop
- Geolocation
- Yes, why not let the user directly specify the location as input, depends on what GPS
- Canvas
Safety
- Tls
- CAPTCHA
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Mastering Dart (Reading notes)-The interesting part is its future, isolates and zones