How can I find the location of a Terminal command and how can I select a different version of it?
You can find the path to a binary by using type:
$ type latex ruby dart
latex is /Library/TeX/texbin/latex
ruby is /usr/bin/ruby
-bash: type: dart: not found

To use a version of a binary stored somewhere else you can

use the full path when calling it:  ~/installs/flutter/bin/cache/dart-sdk/bin/dart
define an alias (won't work in scripts): alias dart=~/installs/flutter/bin/cache/dart-sdk/bin/dart
adjust PATH: PATH=~/installs/flutter/bin/cache/dart-sdk/bin:$PATH