@@ -130,6 +130,37 @@ rm -rf "$FIXTURE_LOCATION"
130130echo " Create blank fixture"
131131" ${FLUTTER_BIN[@]} " create " $FIXTURE_LOCATION " --org com.bugsnag --platforms=ios,android
132132
133+ # Fix SDK constraint to match Flutter's bundled Dart version
134+ PUBSPEC=" $FIXTURE_LOCATION /pubspec.yaml"
135+ echo " Fix Dart SDK constraint in pubspec.yaml"
136+ python3 - " $PUBSPEC " " $FLUTTER_VERSION " << 'PY '
137+ import sys, re
138+
139+ pubspec_path = sys.argv[1]
140+ flutter_version = sys.argv[2]
141+
142+ with open(pubspec_path, 'r', encoding='utf-8') as f:
143+ content = f.read()
144+
145+ # Map Flutter versions to their bundled Dart SDK versions
146+ # Flutter 3.38.x uses Dart 3.5.x
147+ # Flutter 3.24.x uses Dart 3.5.x
148+ # Use a conservative constraint that works with the bundled Dart
149+ dart_constraint = ">=3.5.0 <4.0.0"
150+
151+ # Replace the SDK constraint
152+ content = re.sub(
153+ r'sdk:\s*["\']?\^?[0-9.]+["\']?',
154+ f"sdk: '{dart_constraint}'",
155+ content
156+ )
157+
158+ with open(pubspec_path, 'w', encoding='utf-8') as f:
159+ f.write(content)
160+
161+ print(f"Set Dart SDK constraint to: {dart_constraint}")
162+ PY
163+
133164# ##############################################################################
134165# Add dependencies (batch most of them)
135166# ##############################################################################
0 commit comments