callback method
dynamic
callback(
- Function func, [
- dynamic arg0,
- dynamic arg1,
- dynamic arg2,
- dynamic arg3,
- dynamic arg4,
- dynamic arg5,
inherited
Implementation
callback(Function func, [arg0, arg1, arg2, arg3, arg4, arg5]) {
String arguments = func.runtimeType.toString().split(' => ')[0];
if (arguments.length > 3) {
String args = arguments.substring(1, arguments.length - 1);
args = args.replaceAll(RegExp("<(.*)>"), "");
int argc = args.split(', ').length;
switch (argc) {
case 1:
func(arg0 ?? null);
break;
case 2:
func(arg0 ?? null, arg1 ?? null);
break;
case 3:
func(arg0 ?? null, arg1 ?? null, arg2 ?? null);
break;
case 4:
func(arg0 ?? null, arg1 ?? null, arg2 ?? null, arg3 ?? null);
break;
case 5:
func(arg0 ?? null, arg1 ?? null, arg2 ?? null, arg3 ?? null,
arg4 ?? null);
break;
case 5:
func(arg0 ?? null, arg1 ?? null, arg2 ?? null, arg3 ?? null,
arg4 ?? null, arg5 ?? null);
break;
}
} else {
func();
}
}