Skip to main content

Posts

Showing posts from September, 2025

Set up Node.js

  Set up Node.js . On Apple Silicon, the setup is almost the same as Intel, but some tools need ARM64 builds. I'll give you the main methods step by step: ✅ Method 1: Install Node.js with Homebrew (simple & recommended) Install Homebrew (if not already installed): /bin/bash -c " $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) " Install Node.js (includes npm): brew install node Verify installation : node -v npm -v You should see versions (e.g., v22.x.x for Node and 10.x.x for npm). ✅ Method 2: Install Node.js using Node Version Manager (nvm) (best for multiple versions) 👉 Recommended if you work on different projects needing different Node versions. Install nvm : curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash Load nvm (add this to your ~/.zshrc or ~/.bashrc ): export NVM_DIR= " $HOME /.nvm" [ -s " $NVM_DIR /nvm.sh" ] && \. " $NVM_DIR...

Set up MySQL on your MacBook Pro with the M1 (Apple Silicon)

Set up MySQL on your MacBook Pro with the M1 (Apple Silicon). I'll give you the step-by-step installation methods . You can choose whichever suits you best: ✅ Method 1: Install MySQL using Homebrew (Recommended) This is the easiest and cleanest way. Install Homebrew (if not already installed): Open Terminal and run:      Terminal Command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Install MySQL : brew install mysql Start MySQL service : brew services start mysql Check MySQL status : brew services list Login to MySQL : mysql -u root (Optional) Set root password : ALTER USER 'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password' ; FLUSH PRIVILEGES; ✅ Method 2: Install MySQL using the official DMG installer If you prefer GUI setup: Go to MySQL Community Downloads . Select macOS (ARM64) for M1. Download the DMG Archive and install it...

The background and foreground state of the app itself in Flutter

About the  background and foreground state of the app itself in Flutter . This is different from widget state — this is about the lifecycle of the entire app . 🔹 Foreground vs Background in Flutter Foreground state → your app is visible on screen (user is actively using it). Background state → user pressed Home , switched to another app, or screen is off (your app is running but not visible). Terminated → user killed the app or system closed it. 🔹 Detecting App Lifecycle in Flutter Flutter provides WidgetsBindingObserver or the AppLifecycleState enum. Example:  import 'package:flutter/material.dart'; class AppLifecycleExample extends StatefulWidget {   @override   _AppLifecycleExampleState createState() => _AppLifecycleExampleState(); } class _AppLifecycleExampleState extends State<AppLifecycleExample>     with WidgetsBindingObserver {   AppLifecycleState? _lastState;   @override   void initState() {     ...