I'm still pretty new to Dart, and the syntax => (bold arrow) still confuses me (I'm from C # background).
So in C # the bold arrow (=>) says: goes to like this for example:
Action<string> action1 = (str) => { System.Diagnostic.Debug.WriteLine("Parameter received: " + str.ToString()); }
action1("Some parameter");
means: whatever the action1quality of the parameter in action1(if it can be converted to string), it falls into the inner region (in our case, it simply prints inDebug.WriteLine()
but in darts it's something else .... (?)
for example, in Future.then
ClassWithFutures myClass = new ClassWithFutures();
myClass.loadedFuture.then(
(str) => { print("Class was loaded with info: $str"),
onError: (exp) => { print("Error occurred in class loading. Error is: $exp"); }
);
Editor darts warns me that the first and second print: Expected string literal for map entry key. I think in C # so that strit's just a name for a parameter that will be populated with an internal callback that is Future.thenused to call onValueoronError
What am I doing wrong?
source