Can I change the Dart/Flutter SDK versions on Dartpad.dev?

268 Views Asked by At

Context

I am currently working on a project that requires the use of Dartpad.dev, and I'm looking to modify the Flutter/Dart SDK version for my specific needs.

In a typical environment, altering the SDK version can be achieved by updating the pubspec.yaml file like so:

environment:
  sdk: ">=2.11.0 <3.0.0"

However, I'm uncertain how this can be accomplished within Dartpad.dev, given its unique environment.

What I tried:

In an attempt to change the SDK version, I added the following line at the beginning of my dartpad file:

// @dart=2.9

Unfortunately, this resulted in an error message stating:

The language version must be >=2.12.0.

This leads me to wonder if it's even possible to downgrade the SDK version in this environment.

The question

  • Is there a way to change the Flutter/Dart SDK version on Dartpad.dev? If so, what is the process?

Side note

I recall that in the pre-null-safety era, when the feature was still experimental, it was possible to alter a query parameter in the Dartpad link to allow for null safety.

However, my requirement goes beyond this, I am interested in changing the actual Dart SDK version, not just enabling or disabling null safety. Is this level of customization possible on Dartpad.dev?

Related
1

There are 1 best solutions below

1
On

This might work, you can change the channel and run your code.