Repository: flutter/flutter
File: packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets_host.dart (Dart)

Code before:
  final ProcessResult installNameResult = await globals.processManager.run(<String>[
    'otool',
    '-D',
    dylibFile.path,
  ]);
  if (installNameResult.exitCode != 0) {
    throwToolExit('Failed to get the install name of $dylibFile:\n${installNameResult.stderr}');
  }

  return <String>{
    for (final List<String> architectureSection in parseOtoolArchitectureSections(
      installNameResult.stdout as String,
    ).values)
      // For each architecture, a separate install name is reported, which are
      // not necessarily the same.
      architectureSection.single,
  };
}

/// Creates a dSYM bundle for a dylib.
Future<void> dsymutilDylib(File dylibFile) async {
  final dsymPath = '${dylibFile.path}.dSYM';
  final ProcessResult result = await globals.processManager.run(<String>[
    'dsymutil',
    dylibFile.path,
    '-o',
    dsymPath,
  ]);
  if (result.exitCode != 0) {
    globals.logger.printError(result.stdout as String);
    globals.logger.printError(result.stderr as String);
    throwToolExit('dsymutil failed with exit code ${result.exitCode}');
  }
}

/// Strips a dylib.
///
/// This is useful for release builds to reduce binary size.
Future<void> stripDylib(File dylibFile) async {
  final ProcessResult result = await globals.processManager.run(<String>[
    'strip',
    '-x', // Remove local symbols.
    '-S', // Remove debugging symbol table.
    dylibFile.path,
  ]);
  if (result.exitCode != 0) {
    globals.logger.printError(result.stdout as String);
    globals.logger.printError(result.stderr as String);
    throwToolExit('strip failed with exit code ${result.exitCode}');
  }
}

Review comment (suggestion):
See comment: https://github.com/flutter/flutter/pull/181533#issuecomment-3815090687

This likely needs to be changed to output to somewhere outside of the framework, and then copied into the `BUILT_PRODUCTS_DIR`, likely in xcode_backend.dart

Code after:
  final ProcessResult installNameResult = await globals.processManager.run(<String>[
    'otool',
    '-D',
    dylibFile.path,
  ]);
  if (installNameResult.exitCode != 0) {
    throwToolExit('Failed to get the install name of $dylibFile:\n${installNameResult.stderr}');
  }

  return <String>{
    for (final List<String> architectureSection in parseOtoolArchitectureSections(
      installNameResult.stdout as String,
    ).values)
      // For each architecture, a separate install name is reported, which are
      // not necessarily the same.
      architectureSection.single,
  };
}

/// Creates a dSYM bundle for a dylib.
Future<void> dsymutilDylib(File dylibFile, String dsymPath) async {
  final ProcessResult result = await globals.processManager.run(<String>[
    'dsymutil',
    dylibFile.path,
    '-o',
    dsymPath,
  ]);
  if (result.exitCode != 0) {
    globals.logger.printError(result.stdout as String);
    globals.logger.printError(result.stderr as String);
    throwToolExit('dsymutil failed with exit code ${result.exitCode}');
  }
}

/// Strips a dylib.
///
/// This is useful for release builds to reduce binary size.
Future<void> stripDylib(File dylibFile) async {
  final ProcessResult result = await globals.processManager.run(<String>[
    'strip',
    '-x', // Remove local symbols.
    '-S', // Remove debugging symbol table.
    dylibFile.path,
  ]);
  if (result.exitCode != 0) {
    globals.logger.printError(result.stdout as String);
    globals.logger.printError(result.stderr as String);
    throwToolExit('strip failed with exit code ${result.exitCode}');
  }
}