Home > Mobile >  Flutter about methods and problems
Flutter about methods and problems

Time:01-26

Brothers, all have the Flutter? Is there a similar to the Flutter get string (@ StringRes int resId, Object... FormatArgs) inside formatArgs the way, can only use the List?

CodePudding user response:

Find a way to copy write:
 
Typedef dynamic OnCall (List);

The class VarargsFunction extends the Function {
OnCall _onCall;

VarargsFunction (enclosing _onCall);

Call ()=& gt; _onCall ([]);

NoSuchMethod (Invocation Invocation) {
Final arguments=invocation. PositionalArguments;
Return _onCall (the arguments);
}
}

The main () {
Final superHeroes=new VarargsFunction ((the arguments) {
For (final superHero in the arguments) {
Print (" There 's no stopping ${superHero} ");
}
});
SuperHeroes (' UberMan ', 'Exceptional' Woman ', 'The Hunk');
}


You have a better way? Talk about bai
  • Related