Mocking Dart HTTP Client When Testing Flutter Widgets

If you’re not familiar with HTTP and Flutter widget tests, testWidgets() mocks the Dart http.Client to always return an HTTP 400 status! Surprising, I know. The idea is that you shouldn’t make real HTTP calls from your widget tests. But I think 99.9% of the time, this is not the response you want. Typically, you could mock the HTTP client with MockClient. This will work if you can provide an HttpClient directly to your widget. [Read More]

Deploy a Flutter web app and API to AWS CloudFront and S3 using Terraform

Over the years, I have used AWS Route 53, CloudFront, and S3 to deploy single-page web apps (SPA). Most of the time the backend API is delivered alongside the web app. This has a lot of advantages: Eliminates CORS issues Provides superfast delivery of the web app via CloudFront’s CDN CloudFront may provide faster access to your API than connecting from the browser/app to an AWS region. This is unintuitive, but if the CloudFront edge node is closer to your browser, there will be less latency. [Read More]