Obtain the Dart SDK from src/flutter/third_party/dart if available

The Dart SDK will be moved from src/third_party/dart to src/flutter/third_party/dart during the buildroot migration.  This change uses the new path if available and otherwise falls back to the original path.

See https://github.com/flutter/flutter/issues/143335

Change-Id: If8fcd22818d3b55232a4c506652a997db2093ee1
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/55881
Commit-Queue: Jason Simmons <jsimmons@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
diff --git a/recipe_modules/repo_util/api.py b/recipe_modules/repo_util/api.py
index a7c2a78..543b5ff 100644
--- a/recipe_modules/repo_util/api.py
+++ b/recipe_modules/repo_util/api.py
@@ -474,8 +474,13 @@
   def engine_environment(self, checkout_path):
     """Returns env and env_prefixes of an flutter/dart command environment."""
     dart_bin = checkout_path.join(
-        'src', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin'
+        'src', 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk',
+        'bin'
     )
+    if not self.m.path.exists(dart_bin):
+      dart_bin = checkout_path.join(
+          'src', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin'
+      )
     git_ref = self.m.properties.get('git_ref', '')
     android_home = checkout_path.join(
         'src', 'third_party', 'android_tools', 'sdk'
@@ -523,9 +528,14 @@
   def monorepo_environment(self, checkout_path):
     """Returns env and env_prefixes of a monorepo command environment."""
     dart_bin = checkout_path.join(
-        'engine', 'src', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk',
-        'bin'
+        'engine', 'src', 'flutter', 'third_party', 'dart', 'tools', 'sdks',
+        'dart-sdk', 'bin'
     )
+    if not self.m.path.exists(dart_bin):
+      dart_bin = checkout_path.join(
+          'engine', 'src', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk',
+          'bin'
+       )
     git_ref = self.m.properties.get('git_ref', '')
     android_home = checkout_path.join(
         'engine', 'src', 'third_party', 'android_tools', 'sdk'