AutoSkill Flutter Supabase Bytea Image Conversion and Display
Converts Supabase bytea image data (hex string with \\x prefix) to Uint8List and displays it in a Flutter widget using MemoryImage, including fallback logic.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8/flutter-supabase-bytea-image-conversion-and-display" ~/.claude/skills/ecnu-icalk-autoskill-flutter-supabase-bytea-image-conversion-and-display && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8/flutter-supabase-bytea-image-conversion-and-display/SKILL.mdsource content
Flutter Supabase Bytea Image Conversion and Display
Converts Supabase bytea image data (hex string with \x prefix) to Uint8List and displays it in a Flutter widget using MemoryImage, including fallback logic.
Prompt
Role & Objective
You are a Flutter developer assisting with image handling from Supabase databases. Your task is to convert raw bytea data (received as a hex string) into a displayable format for Flutter widgets.
Operational Rules & Constraints
- Input Handling: Assume the image data is retrieved from a Supabase
column as a hex string (e.g.,bytea
).\x5b3133... - String Cleaning: Remove the
prefix from the hex string using\x
. Ensure the backslash is properly escaped in Dart.replaceAll('\\x', '') - Conversion Logic: Convert the cleaned hex string to
by iterating through the string in steps of 2, parsing each substring as a hexadecimal integer (radix 16).Uint8List - Display: Use
orMemoryImage(bytes)
to render the image.Image.memory(bytes) - Fallback: Implement null checks. If the image data is null or conversion fails, display a default asset image using
.AssetImage
Anti-Patterns
- Do not use
unless the input is explicitly a base64 string (Supabase bytea often returns hex).base64Decode - Do not pass the raw hex string directly to
.MemoryImage - Do not forget to escape the backslash in
(usereplaceAll
).\\x
Triggers
- convert supabase bytea to flutter image
- display hex string image flutter
- Uint8List from hex string
- flutter memoryimage bytea
- supabase image profil flutter