Freezed Snippets for Zed
A collection of Freezed snippets for Flutter development in the Zed editor. These snippets are designed to accelerate your Freezed workflow and are only available in .dart files.
Installation
From Zed Extensions (Recommended)
- Open Zed
- Go to Extensions (
Ctrl+Shift+XorCmd+Shift+X) - Search for "Riverpod Snippets"
- Click Install
Available Snippets
| Prefix | Description |
|---|---|
freezedpart |
Creates a part statement for Freezed code generation |
freezeddataclass |
Creates a basic Freezed data class (no JSON serialization) |
freezedjsonclass |
Creates a Freezed class with JSON serialization support |
freezedjsonstatement |
Creates a fromJson factory method |
freezedunionclass |
Creates a Freezed union/sealed class |
freezedunioncase |
Adds a union case to an existing Freezed union class |
freezedjsonclassic |
Creates a Freezed classic class with serialization support |
freezeddataclassic |
Creates a Freezed Classic Class with no serialization support |
Usage
- Open a
.dartfile in Zed - Type the snippet prefix (e.g.,
freezeddataclass) - Press
Tabto expand the snippet - Use
Tabto navigate between placeholders - Fill in the values and press
Tabto move to the next placeholder
Examples
Adding a Part Statement
Type freezedpart and press Tab:
part 'my_model.freezed.dart';part statement is required for Freezed to work properly.
Basic Data Class
Type freezeddataclass and press Tab:
@freezed
abstract class User with _$User {
const factory User({
required String name,
required int age,
}) = _User;
}Data Class with JSON Serialization
Type freezedjsonclass and press Tab:
@freezed
abstract class Product with _$Product {
const factory Product({
required String id,
required String name,
required double price,
}) = _Product;
factory Product.fromJson(Map<String, dynamic> json) => _$ProductFromJson(json);
}Union/Sealed Class
Type freezedunionclass and press Tab:
@freezed
class Result with _$Result {
const factory Result.success({required String data}) = Success;
const factory Result.error({required String message}) = Error;
}Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Apache License 2.0 - see LICENSE for details.