Skip to content

Problem with "--dart-define" when value contains two forward slashes "//" (URL, etc.) #57812

@VladyslavBilomeria

Description

@VladyslavBilomeria

Steps to Reproduce

  1. Add anywhere in your code:

static const String BASE_API_URL = const String.fromEnvironment('BASE_API_URL');

and

print('url: [$BASE_API_URL]');

  1. Run

flutter run --dart-define=BASE_API_URL=https://api.flutter.dev/

Expected results:
output: "url: [https://api.flutter.dev/]"

Actual results:
output: "url: [https:]"

In the case when the value contains 1 slash, the result is correct. Two slashes cut the string.

Logs
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-GB)
    • Flutter version 1.17.1 at /Users/vladyslav/development/flutter
    • Framework revision f7a6a7906b (10 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/vladyslav/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • iPhone SE (2nd generation) • 058E8201-B417-4B8A-A2B2-D80692359220 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions