Posts

Understanding three-page flutter app with navigation

This time focus primarily on the comments around Navigator . import 'package:flutter/material.dart'; void main() {   // Start application.   runApp(const MyApp()); } // Root application widget. class MyApp extends StatelessWidget {   const MyApp({super.key});   @override   Widget build(BuildContext context) {     return MaterialApp(       debugShowCheckedModeBanner: false,       // Page 1 is our starting page.       home: const HomePage(),     );   } } // ====================================================== // PAGE 1 - HOME PAGE // ====================================================== class HomePage extends StatelessWidget {   const HomePage({super.key});   @override   Widget build(BuildContext context) {     return Scaffold(       appBar: AppBar(         title: ...

Understanding single-page flutter app with state

// Imports Flutter's Material Design widgets such as // Scaffold, Text, Button, AppBar, etc. import 'package:flutter/material.dart'; // Every Dart application starts from main() void main() {   // Starts the Flutter application.   // MyApp becomes the root widget.   runApp(const MyApp()); } // Root widget of our application. class MyApp extends StatelessWidget {   const MyApp({super.key});   @override   Widget build(BuildContext context) {     // MaterialApp provides the basic app configuration.     return MaterialApp(       // Removes the DEBUG banner.       debugShowCheckedModeBanner: false,       // HomePage is the first screen.       home: const HomePage(),     );   } } // StatefulWidget is used because the counter will change. class HomePage extends StatefulWidget {   const HomePage({super.key}); ...

Dart Cheat Sheet for Flutter

Here’s a practical Dart cheat sheet for Flutter development , focused on the syntax and patterns you’ll use most often. 1. Variables String name = 'Ganesh'; int age = 30; double price = 99.50; bool active = true; Type inference var name = 'Ganesh';   // inferred as String var count = 10;        // inferred as int final vs const final currentTime = DateTime.now(); const pi = 3.14159; Keyword Meaning var Type inferred final Assigned once at runtime const Compile-time constant 2. Common Data Types String name = 'Ganesh'; int quantity = 10; double amount = 25.50; bool enabled = true; List<String> items = ['A', 'B']; Set<int> ids = {1, 2, 3}; Map<String, dynamic> user = {   'name': 'Ganesh',   'age': 30, }; 3. String Operations String firstName = 'Ganesh'; String lastName = 'Pillai'; Interpolation String message = 'Hello $firstName'; String message2 = 'Hello ${firstName.toUpperCase...

Files in your Flutter Project

  In a Flutter project , the files are organized so that your Dart application code , UI resources , platform-specific Android/iOS code , dependencies , and build configuration remain separated. A typical project looks like this: my_flutter_app/ ├── lib/ │   └── main.dart ├── test/ ├── android/ ├── ios/ ├── web/ ├── windows/ ├── macos/ ├── linux/ ├── pubspec.yaml ├── pubspec.lock ├── analysis_options.yaml ├── .gitignore └── README.md 1. lib/ ⭐ Most important This is where almost all of your Flutter application code lives . lib/ ├── main.dart ├── screens/ ├── widgets/ ├── models/ ├── services/ └── utils/ For most day-to-day Flutter development, you spend the majority of your time here. main.dart The entry point of the Flutter application. A minimal example: import 'package:flutter/material.dart'; void main() {   runApp(const MyApp()); } class MyApp extends StatelessWidget {   const MyApp({super.key});   @override   Widget build(BuildContext context) ...

Flutter setup on Windows 11 using VS Code + Android Emulator

For Windows 11 + VS Code + Android Emulator , I recommend using VS Code as your coding/debugging IDE and installing Android Studio primarily for the Android SDK, SDK tools, and emulator . Flutter's current documentation recommends VS Code as a supported installation path, while Android Studio provides the Android tooling required for an emulator. 1. What you need Install these components: Git for Windows Visual Studio Code Flutter SDK VS Code Flutter extension Android Studio Android SDK Android Emulator / virtual device You do not have to write your application in Android Studio. 2. Install Git Flutter's Windows setup lists Git for Windows as a prerequisite. Install Git, then open PowerShell and verify: git --version You should see something similar to: git version 2.x.x.windows.x Reference: https://docs.flutter.dev/install/quick 3. Install VS Code Install Visual Studio Code , which will be your main development environment. Then open: VS Code → Extensions Search for: Flutter...