accept the SDK license agreements and install the missing components using the Android Studio SDK Manager fix error in flutter code example
Example: flutter accept license
flutter doctor --android-licenses
flutter doctor --android-licenses