PodfileEditor class

iOS and macOS Podfile manipulation helper for CLI install commands.

Provides pure regex-based utilities for reading and modifying Ruby Podfiles without requiring a Dart Ruby AST parser (none exists; regex is the industry standard approach, following FlutterFire CLI's own Gradle-file strategy). All mutation methods are idempotent unless the task spec states otherwise.

Supported DSL constructs:

  • platform :ios, '<version>' and platform :osx, '<version>'
  • target '<name>' do ... end blocks
  • post_install do |installer| ... end blocks

Usage

// Bump the minimum iOS deployment target.
PodfileEditor.setPlatformVersion(
  'ios/Podfile',
  'ios',
  '13.0',
);

// Inject a build-settings hook into post_install.
PodfileEditor.addPostInstallHook(
  'ios/Podfile',
  "  installer.pods_project.targets.each { |t| ... }",
);

// Add a CocoaPod dependency to the Runner target.
PodfileEditor.addPodLine(
  'ios/Podfile',
  'Runner',
  "pod 'Firebase/Core', '~> 10.0'",
);

// Check whether a pod is already declared.
final present = PodfileEditor.hasPod('ios/Podfile', 'Firebase/Core');

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

addPodLine(String podfilePath, String targetName, String podLine) → void
Insert podLine inside the target '<targetName>' do ... end block.
addPostInstallHook(String podfilePath, String hookContent) → void
Insert hookContent inside the post_install do |installer| ... end block of a Podfile.
hasPod(String podfilePath, String podName) bool
Return true if pod '<podName>' is declared anywhere in the Podfile.
setPlatformVersion(String podfilePath, String platform, String version) → void
Update or insert the platform :<token>, '<version>' line in a Podfile.