There are many answers but the only thing that worked for me is to remove > bin from path.
At various places, it is written that the path should be your_path/dart/bin or your_path/flutter/bin but the correct path that you need to enter is the following:
your_path/dart
your_path/flutter