noSuchMethod method

  1. @override
dynamic noSuchMethod(
  1. Invocation invocation
)
override

this implementation will catch any non-implemented method

Implementation

@override

/// this implementation will catch any non-implemented method
dynamic noSuchMethod(Invocation invocation) {
  final dynamic argument = invocation.positionalArguments.single;
  final memberName = invocation.memberName.toString().split('"')[1];

  Logs().d(
    'Missing implementations of Client.nativeImplementations.$memberName. '
    'You should consider implementing it. '
    'Fallback from NativeImplementations.dummy used.',
  );
  switch (memberName) {
    case 'generateUploadKeys':
      return dummy.generateUploadKeys(argument);
    case 'keyFromPassphrase':
      return dummy.keyFromPassphrase(argument);
    case 'decryptFile':
      return dummy.decryptFile(argument);
    case 'shrinkImage':
      return dummy.shrinkImage(argument);
    case 'calcImageMetadata':
      return dummy.calcImageMetadata(argument);
    default:
      return super.noSuchMethod(invocation);
  }
}