Running Your First Flutter App

Running Your First Flutter App#

About#

  • First Run validates setup
  • Default counter app demonstrates core concepts
  • Supports multiple run targets
  • Introduces development workflow

Main Topics#

  1. Run Targets

    • Definition: Device selection
    • Example:
      # List connected:
      flutter devices
      # Run on specific:
      flutter run -d iPhone12
      
  2. Debug Mode

    • Definition: Development configuration
    • Example:
      # Default for:
      flutter run
      
  3. Emulator Usage

    • Definition: Virtual device testing
    • Example:
      # Start emulator:
      flutter emulators --launch Pixel_5
      
  4. Physical Device

    • Definition: Real hardware testing
    • Example:
      # Android:
      adb devices
      # iOS:
      flutter run -d '00008020-001A...'
      
  5. First App Features

    • Definition: Default counter demo
    • Example:
      // Demonstrates:
      // - State management
      // - Widget composition
      // - Hot reload
      

How to Use#

  • Select: Target device
  • Run: Start development
  • Debug: Set breakpoints
  • Reload: See changes instantly

How It Works#

  1. Build: Debug bundle
  2. Deploy: To target
  3. Launch: Main entrypoint
  4. Connect: For hot reload

Example Session:

flutter emulators --launch Pixel_5
flutter run
# Press r for hot reload
# Press R for hot restart

Conclusion#

Running the default Flutter app successfully verifies your development environment is properly configured while demonstrating core framework capabilities. This initial experience showcases Flutter’s hot reload feature and cross-platform execution that form the foundation of productive Flutter development.