PlatformTargetAnalyzer.fromContent constructor

PlatformTargetAnalyzer.fromContent(
  1. String content
)

Parses the annotation from already-loaded content (zero file reads).

Implementation

factory PlatformTargetAnalyzer.fromContent(String content) {
  final match = RegExp(
    r'@NitroModule\s*\(([^)]+)\)',
    dotAll: true,
  ).firstMatch(content);
  final annotation = match == null
      ? ''
      : match.group(1)!.replaceAll('\n', ' ');
  return PlatformTargetAnalyzer._(annotation);
}