Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
•
Sicherheitslücken (CVE)DSA-6530-1 pcre2 - security update(29.09.2026 um 02:00 Uhr)
•
Linux Tipps & HardeningDSA-6529-1 libwebsockets - security update(29.09.2026 um 02:00 Uhr)
•••••••••
Sicherheitslücken (CVE)DSA-6530-1 pcre2 - security update(29.09.2026 um 02:00 Uhr)
•
Linux Tipps & HardeningDSA-6529-1 libwebsockets - security update(29.09.2026 um 02:00 Uhr)
••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Supadart Typesafe Supabase Flutter Queries

Supabase has type generators for other languages... but not for Dart / Flutter Supadart automatically generates Dart classes based on your Supabase schema, providing you with a typesafe way to interact with your database. You can…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Supabase has type generators for other languages... but not for Dart / Flutter



Supadart automatically generates Dart classes based on your Supabase schema, providing you with a typesafe way to interact with your database.



You can generate via CLI or in the Official Website



Assuming you have the following Supabase Schema




create table
public.books (
id bigint generated by default as identity,
name character varying not null,
description text null,
price integer not null,
created_at timestamp with time zone not null default now(),
constraint books_pkey primary key (id)
) tablespace pg_default;





Then it will generate these classes



class Books implements SupadartClass<Books> {
final BigInt id;
final String name;
final String? description;
final int price;
final DateTime? createdAt;

const Books({
required this.id,
required this.name,
this.description,
required this.price,
this.createdAt,
});

static String get table_name => 'books';
static String get c_id => 'id';
static String get c_name => 'name';
static String get c_description => 'description';
static String get c_price => 'price';
static String get c_createdAt => 'created_at';

static List<Books> converter(List<Map<String, dynamic>> data) {
return data.map(Books.fromJson).toList();
}

static Books converterSingle(Map<String, dynamic> data) {
return Books.fromJson(data);
}

static Map<String, dynamic> _generateMap({
BigInt? id,
String? name,
String? description,
int? price,
DateTime? createdAt,
}) {
return {
if (id != null) 'id': id.toString(),
if (name != null) 'name': name,
if (description != null) 'description': description,
if (price != null) 'price': price,
if (createdAt != null) 'created_at': createdAt.toUtc().toIso8601String(),
};
}

static Map<String, dynamic> insert({
BigInt? id,
required String name,
String? description,
required int price,
DateTime? createdAt,
}) {
return _generateMap(
id: id,
name: name,
description: description,
price: price,
createdAt: createdAt,
);
}

static Map<String, dynamic> update({
BigInt? id,
String? name,
String? description,
int? price,
DateTime? createdAt,
}) {
return _generateMap(
id: id,
name: name,
description: description,
price: price,
createdAt: createdAt,
);
}

factory Books.fromJson(Map<String, dynamic> jsonn) {
return Books(
id: jsonn['id'] != null
? BigInt.parse(jsonn['id'].toString())
: BigInt.from(0),
name: jsonn['name'] != null ? jsonn['name'].toString() : '',
description:
jsonn['description'] != null ? jsonn['description'].toString() : '',
price: jsonn['price'] != null ? int.parse(jsonn['price'].toString()) : 0,
createdAt: jsonn['created_at'] != null
? DateTime.parse(jsonn['created_at'].toString())
: DateTime.fromMillisecondsSinceEpoch(0),
);
}

Map<String, dynamic> toJson() {
return _generateMap(
id: id,
name: name,
description: description,
price: price,
createdAt: createdAt,
);
}
}





This makes it easy to interact with your database, and you can use the generated classes in your code.





GitHub logo

mmvergara
/
supadart



Typesafe queries in Supabase Flutter! Generate Flutter / Dart 🎯 classes from your Supabase schema.






Pub Version
Pub Points
GitHub Stars
Runtime Test
GitHub License



Supadart 🎯




Typesafe Supabase Flutter Queries

Generate Flutter / Dart 🎯 classes from your Supabase schema.



// allBooks is a typeof List<Books>
final allBooks = await supabase
.books
.select("*")
.withConverter(Books.converter);




Table of Contents 📚





Features 🚀





  • 🌐 Cli and Web App

  • 🛠️ Typesafe Queries (Create, Read, Equality)

  • 🧱 Immutable Generated Classes

  • 📊 Supports Column Selection Queries

  • 🔢 Supports all Supabase Major datatypes

  • 🗂️ Supports Defined as array types

  • 🗂️ Supports Enums



Conversion Table 📊





































Supabase Identifier PostgreSQL Format JSON Type Dart Type Runtime Tested
# int2 smallint integer int type ✅ type[]✅
# int4 integer integer int type ✅ type[]✅
# int8 bigint integer BigInt type
…



Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Supadart Typesafe Supabase Flutter Queries

Thematisch verwandte Begriffe: Supadart, Typesafe, Supabase, Flutter · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-71189 | An attacker can construct a request that, if issued by another applicati…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag