पाठ 2 / 25
Setting Up and Hot Reload
flutter create, flutter doctor and the edit loop.
The Flutter CLI
After installing the Flutter SDK (which bundles Dart), flutter doctor checks your toolchain: Android SDK, Xcode on macOS, connected devices and IDE plugins. flutter create my_app scaffolds a project with lib/main.dart, a pubspec.yaml for dependencies and assets, and platform folders such as android/ and ios/. flutter run builds and launches on a device or emulator in debug mode. While it runs, hot reload (press r) injects changed code into the running Dart VM and rebuilds widgets while keeping state; hot restart (R) restarts the app and resets state. Changes to main(), global initialisers or native code need a restart or full rebuild.
Everyday commands
Create, check, run and add a package.
flutter doctor # verify SDKs, devices and IDE setup
flutter create my_app # scaffold a new project
cd my_app
flutter devices # list connected devices and emulators
flutter run # build and run in debug mode (r = hot reload, R = hot restart)
flutter pub add http # add a dependency to pubspec.yaml
flutter pub get # fetch dependencies
flutter analyze # static analysis using analysis_options.yamlKnow which reload you need
If a change does not appear after hot reload, it usually touched state initialisation (initState, field initialisers, main) - use hot restart before suspecting a bug.
त्वरित जाँच: What is the key difference between hot reload and hot restart?
- Hot reload keeps app state; hot restart resets it
- Hot reload recompiles native Android and iOS code
- Hot restart only works in release mode
- There is no difference
Answer
Hot reload keeps app state; hot restart resets it — Hot reload patches code into the running VM and rebuilds; hot restart starts the Dart app again.