Skip to content

Instantly share code, notes, and snippets.

View loic-sharma's full-sized avatar

Loïc Sharma loic-sharma

View GitHub Profile
@loic-sharma
loic-sharma / 1_today_c.md
Last active July 21, 2023 23:44
Flutter Windows object model
---
title: Today's Flutter Windows object model
---
flowchart LR
  subgraph "Windows embedder (internal)"
    FlutterWindowsEngine
    FlutterWindowsView
    FlutterDesktopViewControllerState
@loic-sharma
loic-sharma / main.dart
Last active July 2, 2023 19:12
TextField and Shortcuts
import 'package:flutter/material.dart';
class TextFieldSample extends StatelessWidget {
const TextFieldSample({super.key});
@override
Widget build(BuildContext context) {
return CallbackShortcuts(
bindings: <ShortcutActivator, VoidCallback>{
// This causes the shortcut to handle the 'a' key event
PS C:\Code\f\flutter\packages\flutter\test_fixes> dart --version
Dart SDK version: 3.1.0-232.0.dev (dev) (Tue Jun 20 05:07:42 2023 -0700) on "windows_x64"
PS C:\Code\f\flutter\packages\flutter\test_fixes> dart fix --compare-to-golden
Computing fixes in test_fixes...
Error from the analysis server: Exception while getting bulk fixes: Exception generating fix for MISSING_REQUIRED_ARGUMENT in c:\code\f\flutter\packages\flutter\test_fixes\services\services.dart
Bad state: No element
#0 List.last (dart:core-patch/growable_array.dart:348:5)
#1 ModifyParameters.apply (package:analysis_server/src/services/correction/fix/data_driven/modify_parameters.dart:129:36)
#2 DataDrivenFix.compute.<anonymous closure> (package:analysis_server/src/services/correction/dart/data_driven.dart:105:20)
#3 ChangeBuilderImpl.addDartFileEdit (package:analyzer_plugin/src/utilities/change_builder/change_builder_core.dart:151:26)
@loic-sharma
loic-sharma / main.cpp
Last active June 14, 2023 23:17
Windows runner APIs
{
// Create a view. The view controller takes ownership of the engine.
auto controller = FlutterDesktopViewControllerCreate(width, height, engine);
auto view = FlutterDesktopViewControllerGetView(controller);
HWND hwnd = FlutterDesktopViewGetHWND(view);
// Attach the view's HWND to the window...
// Run app...
// Destroy the view controller. This also destroys the view and the engine.
using System.Net.Http.Json;
public class CurrencyRepo : RepoBase, ICurrencyRepo
{
private readonly HttpClient _http;
private readonly string _baseUrl;
public CurrencyRepo(
HttpClient http,
string baseUrl)
@loic-sharma
loic-sharma / main.dart
Last active May 1, 2023 16:55
CallbackShortcuts widget of the week example
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
@loic-sharma
loic-sharma / README.md
Last active April 21, 2023 22:31
Flutter SDK size analysis

Flutter SDK size analysis

The Windows Flutter SDK v3.7.12-stable.zip is 873MB. Here are the top 100 largest compressed items:

file: compressed file size
flutter/.pub-preload-cache/flutter_gallery_assets-1.0.2.tar.gz: 82.5MB
flutter/.git/objects/pack/pack-c596e5cc21ec5194eeaf69bf7115fb05e1a47638.pack: 69.8MB
flutter/bin/cache/artifacts/engine/windows-x64/flutter_windows.dll.pdb: 50.7MB
flutter/bin/cache/artifacts/engine/windows-x64-profile/flutter_windows.dll.pdb: 46.6MB
@loic-sharma
loic-sharma / update-semantics-abi.md
Last active February 9, 2023 18:45
Embedder API goof

ABI stability for the update semantics API

Background

In Flutter 3.7 we introduced a new embedder API for semantics update (flutter/engine#37129):

/// A batch of updates to semantics nodes and custom actions.
typedef struct {
  /// The size of the struct. Must be sizeof(FlutterSemanticsUpdate).
@loic-sharma
loic-sharma / feedback.md
Last active February 13, 2023 20:50
Perfetto feedback

Perfetto trace viewer feedback

Release notes

I got a What's new in DevTools popup. It has a picture of the Perfetto trace viewer, but that picture is really small:

Pasted image 20230207111052

Is there a picture that would work better in this small space?

@loic-sharma
loic-sharma / tutorial.md
Last active January 27, 2025 18:17
How to debug the Flutter engine on Windows

How to debug the Flutter engine on Windows

Let's say your app is misbehaving because of a Flutter engine bug. Let's debug that!

Use Visual Studio to run your app

Let's open your app using Visual Studio:

  1. Run flutter build windows to ensure Flutter has generated a Visual Studio project for your app.
  2. Open ./build/windows/ALL_BUILD.vcxproj in Visual Studio. This project builds the native entry point for your Flutter app.