Flutter mobile - certificate and SSL exclusions for development domains
Get link
Facebook
X
Pinterest
Email
Other Apps
Flutter mobile development gets twisty when working behind corporate firewalls and with self-signed development certificates. We look at a bit of code that can be used in debug builds that sets the emulator/simulator proxies and disables cert checks.
You can use this sample code wrapped in an `if (isKDebug)` when running Flutter on mobile. It lets you exclude your self-signed certificates for your internal domains while leaving certificate checks enabled for production and external domains. The code also sets the proxy when running in the Android Emulator or the iOS Simulator. Setting the proxy is optional, enabled when you pass in the proxy port.
import'dart:io';
///
/// Ignores certificates in developermode for limited set of domains
/// Simplifies development in corporate self signed environment
/// Configures the emulator or simulator proxy if passed proxy port.
/// Assumes there is a proxy running locally if proxy port provided
/// Proxy only used for mobile devices. We assume browser is already configured.
///
classDevelopmentHttpConfigextendsHttpOverrides {
DevelopmentHttpConfig({
requiredthis.certExclusionDomains,
this.iosProxyHost='127.0.0.1',
this.androidProxyHost='10.0.2.2',
this.proxyPort,
});
/// Proxy used for android
/// Defaults to the 10.0.2.x network
StringandroidProxyHost;
/// Proxy used for IOS because it uses the host network. defaults to 127.0.0.1
/// Android has its own network
StringiosProxyHost;
/// list of domains we exclude from cert check
List<String> certExclusionDomains;
/// proxyPort != null means setup the proxy if isAndroid or isIOS
I've worked in corporate environments where the Android 10.0.2.1 doesn't work for reaching sites and I have to use the corporate proxy instead.
Example usage from test case
Here are two test cases. "wrong.host.badssl.com" is a test site with a bad certificate. We test connecting to it with that domain in our "do not check list" and again with it not in the list.
Today's app is a Dice roller for the Pimoroni BadgeWare devices , supporting both the E-Ink Badger and the TFT Tufty . The MicroPython-based app lets you roll from 2 to 6 dice with 4 to 20 sides. The allocated dice can be any combination of sides. The app defaults to rolling all the dice every time but lets you freeze any number of the dice and re-roll. The codebase can be installed to add to the main menu page or replace the menu page to be the only app on the device. The Pimoroni BadgeWare series are programmable, hackable devices in a digital conference badge form factor. They have lanyard loops, built-in batteries, wi-fi, Bluetooth, and QT/ST (Stemma) IOT sensor connectors. This single app supports both displays and their different power management profiles. It does not support the RGB-LED display Blinky. Dice Demo Click to expand A six minute demo video UI Walkthrough The E-Ink Badger is on the left. Th...
You download GitHub code by "cloning" the repository to a local repository. They call this a desktop clone. Each GitHub repository home page has a neat "Clone to Desktop" button in the web interface that you would think clones the repository to your desktop. That button actually takes you to the GitHub Windows application download page even if you have the GitHub app already installed. This is where I usually get stuck and head off to some search engine for help. The Windows GitHub application tries to tell you what to do at the bottom of the "local repository" screen. It says to "Drag a repository here to add". That phrase always confused me. I can never figure out where to drag the repository from. It turns out you are supposed to drag the URL for the repository from your browser onto the desktop application. Resize your browser window so you can drag the repository onto the GitHub windows application. ...
Claude Desktop's Hardware Buddy uses a published Bluetooth LE protocol, so any device that implements it can act as a status display for your Claude sessions. This implementation runs on an M5Stack Core2 (ESP32) and leans into the fun side: tap the screen to pet it, flip it face-down to put it to sleep, or shake it until it's dizzy. The device runs the Anthropic protocol on an M5Stack Core2 to show what Claude is doing, let you approve prompts from the device, and play with an animated pet that likes attention. It also shows open sessions, waiting prompts, token count, and battery level, and you can approve permission prompts right on the device. On battery, it dims itself when nothing is happening. The repo includes Claude Code skills that identify the board, flash the UIFlow 2.0 firmware, and install the app for you. The Bluetooth connection isn't encrypted, so it's best used at home. Links Code: https://github.com/freemansoft/build-with-claude Anthropic's Ha...