https://github.com/Alexisvt/flutter-snippets
1.Flutterスニペット
fstful
(StatefulWidget snippet):
これは、StatefulWidgetを簡単に作成するスニペットです。StatefulWidgetは、状態を持つウィジェットを作成する際に使用されます。

fstless
(StatelessWidget snippet):
これは、StatelessWidgetを簡単に作成するスニペットです。StatelessWidgetは、状態を持たない静的なウィジェットを作成する際に使用されます。

fscaff
(Scaffold widget snippet):
Scaffoldウィジェットを作成するスニペットです。Scaffoldは、アプリケーションの基本的なレイアウト構造を提供するウィジェットです。

fedgall
(EdgeInsets widget snippet with named constructor all):
EdgeInsetsウィジェットのnamed constructorであるall
を使用するスニペットです。EdgeInsetsは、ウィジェットの周囲の余白を調整するのに使用されます。

ftxt
(Text widget snippet):
これは、Textウィジェットを簡単に作成するスニペットです。Textウィジェットはテキストを表示するために使用されます。

finitlf
(Flutter initState lifecycle method snippet):
これは、FlutterのライフサイクルメソッドであるinitState
を簡単に作成するスニペットです。initStateはウィジェットが初期化される際に実行されるメソッドです。

fic
(Flutter Icon widget snippet):
これは、FlutterのIconウィジェットを作成するスニペットです。Iconウィジェットはアイコンを表示するために使用されます。

fcont
(Flutter Container widget snippet):
これは、FlutterのContainerウィジェットを作成するスニペットです。Containerウィジェットは、ウィジェットの配置やスタイリングを制御するために使用されます。


fcent
(Flutter Center widget snippet):
これは、FlutterのCenterウィジェットを作成するスニペットです。Centerウィジェットは、子ウィジェットを中央に配置するために使用されます。

frow
(Flutter Row widget snippet):
これは、FlutterのRowウィジェットを作成するスニペットです。Rowウィジェットは水平方向に子ウィジェットを配置するために使用されます。


fcol
(Flutter Column widget snippet):
これは、FlutterのColumnウィジェットを作成するスニペットです。Columnウィジェットは垂直方向に子ウィジェットを配置するために使用されます。

fex
(Expand widget snippet):
これは、FlutterのExpandウィジェットを作成するスニペットです。Expandウィジェットは、親ウィジェット内で子ウィジェットを可能な限り拡張するために使用されます。


fszbw
(SizedBox widget snippet with just width argument):
これは、FlutterのSizedBoxウィジェットを作成し、幅のみを指定するスニペットです。SizedBoxウィジェットは、指定されたサイズのボックスを作成するために使用されます。

fszbh
(SizedBox widget snippet with just height argument):
これは、FlutterのSizedBoxウィジェットを作成し、高さのみを指定するスニペットです。SizedBoxウィジェットは、指定されたサイズのボックスを作成するために使用されます。

fszb
(SizedBox widget with width and height arguments):
これは、FlutterのSizedBoxウィジェットを作成し、幅と高さを指定するスニペットです。SizedBoxウィジェットは、指定されたサイズのボックスを作成するために使用されます。

fedgsym
(EdgeInsets widget with named constructor symmetric):
これは、EdgeInsetsウィジェットのnamed constructorであるsymmetric
を使用するスニペットです。symmetricを使用すると、水平方向と垂直方向の余白を同じ値で設定できます。

fedgsymv
(EdgeInsets widget with named constructor symmetric with vertical
これは、EdgeInsetsウィジェットのnamed constructorであるsymmetric
を使用し、垂直方向の余白のみを指定するスニペットです。

fedgsymh
(EdgeInsets widget with named constructor symmetric with horizontal parameter):
これは、EdgeInsetsウィジェットのnamed constructorであるsymmetric
を使用し、水平方向の余白のみを指定するスニペットです。

fimpmat
(Add material’s package import statement):
これは、Materialパッケージのimport文を追加するスニペットです。Materialパッケージは、Flutterで標準的なデザイン要素を提供するために使用されます。

fstream
(Display a StreamBuilder widget):
これは、StreamBuilderウィジェットを作成するスニペットです。StreamBuilderは、ストリームからデータを受信し、UIを自動的に更新するために使用されます。

felbtn
(Flutter ElevatedButton snippet):
これは、FlutterのElevatedButtonウィジェットを作成するスニペットです。ElevatedButtonは、押下可能なボタンを作成するために使用されます。

2.Dartスニペット
dvar
(Dart variable declaration using var):
これは、Dartでvar
を使用して変数を宣言するスニペットです。var
を使用すると、変数の型を自動的に推論してくれます。

dfinal
(Dart variable declaration using final):
これは、Dartでfinal
を使用して変数を宣言するスニペットです。final
変数は一度設定された後に再代入できません。

dconst
(Dart variable declaration using const):
これは、Dartでconst
を使用して不変の変数を宣言するスニペットです。const
変数はコンパイル時に計算される必要があります。

dinvar
(Dart Public Instance variable snippet):
これは、Dartで公開インスタンス変数を宣言するスニペットです。公開変数はクラスの外部からアクセスできます。

dprinvar
(Dart Private instance variable snippet):
これは、Dartでプライベートなインスタンス変数を宣言するスニペットです。プライベート変数は名前の前にアンダースコア(_)を付けて定義されます。

dmt
(Dart public method snippet):
これは、Dartで公開メソッドを宣言するスニペットです。公開メソッドはクラスの外部から呼び出すことができます。

dprmt
(Dart private method snippet):
これは、Dartでプライベートなメソッドを宣言するスニペットです。プライベートメソッドは名前の前にアンダースコア(_)を付けて定義されます。

darr
(Dart public arrow function snippet):
これは、Dartで公開のアロー関数を宣言するスニペットです。アロー関数は簡潔な関数を作成するための方法です。

例:int add(int a, int b) => a + b;
dprarr
(Dart private arrow function snippet):
これは、Dartでプライベートなアロー関数を宣言するスニペットです。プライベート関数は名前の前にアンダースコア(_)を付けて定義されます。

dopnctor
(Dart optional named parameters constructor snippet):
これは、Dartでオプションの名前付きパラメータを持つコンストラクタを宣言するスニペットです。名前付きパラメータは引数のオプションを提供します。

例:MyClass({int? param1, String? param2}) { // コンストラクタの実装をここに記述 }
dlist
(Dart List collection snippet):
これは、DartでList(リスト)コレクションを宣言するスニペットです。リストは複数の要素を保持するために使用されます。

例:List<String> fruits = [‘Apple’, ‘Banana’, ‘Orange’];
dmap
(Dart Map collection snippet):
これは、DartでMap(マップ)コレクションを宣言するスニペットです。マップはキーと値のペアを保持するために使用されます。

例:Map<String, int> ages = { ‘Alice’: 30, ‘Bob’: 25, ‘Carol’: 35, };
dset
(Dart Set collection snippet):
これは、DartでSet(セット)コレクションを宣言するスニペットです。セットは一意の要素のコレクションを保持するために使用されます。

例:Set<String> uniqueNames = {‘Alice’, ‘Bob’, ‘Carol’};
dgetarr
(Dart arrow function getter snippet):
これは、Dartでアロー関数を使用してゲッターを宣言するスニペットです。アロー関数を使用すると、簡潔なゲッターを定義できます。

例:int get doubleValue => _value * 2;
dimpas
(Dart import as snippet):
これは、Dartでライブラリをas
キーワードを使用してインポートするスニペットです。as
キーワードを使用すると、ライブラリの名前を別名で使用できます。

例:import ‘package:my_library/my_library.dart’ as mylib;
dimpshow
(Dart import show snippet):
これは、Dartでライブラリをshow
キーワードを使用して一部の要素のみをインポートするスニペットです。指定した要素だけが利用可能になります。

例:import ‘package:my_library/my_library.dart’ show MyClass, myFunction;
dimplazy
(Dart import deferred as snippet):
これは、Dartでライブラリを遅延読み込み(deferred loading)とas
キーワードを使用してインポートするスニペットです。遅延読み込みを使用すると、必要に応じてライブラリを読み込むことができます。

例:import ‘package:my_library/my_library.dart’ deferred as mylib;
補足:
遅延読み込み(deferred loading)は、Dartでライブラリを遅延して読み込むための仕組みを指します。この仕組みは、特定のライブラリをプログラム実行中に必要に応じて読み込むことができるようにするものです。これは、アプリケーションの起動時にすべてのライブラリを読み込むのではなく、必要になった時点で読み込むことができるという柔軟性を提供します。
通常、Dartのライブラリはアプリケーションが起動するときに一度に読み込まれます。しかし、アプリケーションが大規模である場合、すべてのライブラリを最初から読み込むとメモリの消費が増え、アプリケーションの起動時間が遅くなる可能性があります。
遅延読み込みを使用すると、アプリケーションの特定の状況や必要性に応じてライブラリを遅延して読み込むことができます。これは deferred as
スニペットで示されています。
dimphide
(Dart import hide snippet):
これは、Dartでライブラリをhide
キーワードを使用して特定の要素を除外してインポートするスニペットです。指定した要素を除外します。

例:import ‘package:my_library/my_library.dart’ hide myClass;
dexhide
(Dart export hide snippet):
これは、Dartでライブラリから特定の要素をhide
キーワードを使用して非公開にするスニペットです。指定した要素を非公開にします。

例:export ‘package:my_library/my_library.dart’ hide myClass;
dexshow
(Dart export show snippet):
これは、Dartでライブラリから特定の要素のみをshow
キーワードを使用して公開するスニペットです。指定した要素だけが公開されます。

例:export ‘package:my_library/my_library.dart’ show myClass, myFunction;
dconvert
(Dart convert lib import snippet):
これは、Dartのconvert
ライブラリをインポートするスニペットです。convert
ライブラリはデータの変換に関連した機能を提供します。

dimpmeta
(Add meta package import statement):
これは、Dartのmeta
パッケージのimport文を追加するスニペットです。meta
パッケージはアノテーション(注釈)をサポートするために使用されます。

dan
(Add a Dart anonymous function):
これは、Dartで匿名関数(無名関数)を作成するスニペットです。匿名関数は名前のない関数を定義するために使用されます。

dcla
(Add Dart Class snippet):
これは、Dartでクラスを宣言するスニペットです。Dartクラスはオブジェクト指向プログラミングで使用されます。

dclae
(Add Dart Class snippet with extends keyword):
これは、Dartでextends
キーワードを使用してクラスを宣言するスニペットです。extends
キーワードを使用すると、クラスを他のクラスから派生させることができます。

3.Flutter Blocパターンのスニペット
fblocprov(Flutter bloc provider snippet)
これは、FlutterのBlocパターンでBlocProviderを簡単に生成するスニペットです。BlocProviderは、Flutterアプリケーション内でBlocを提供するために使用されます。
このスニペットは、Blocパターンを使用してアプリケーションの状態管理を行う際に、BlocProviderの使用を効率化するのに役立ちます。BlocProviderは依存性の注入に使用され、アプリケーション全体で状態を共有するのに役立ちます。

例:
BlocProvider(
create: (context) => MyBloc(), // Blocを生成して提供する
child: MyWidget(), // Blocにアクセスするウィジェット
)
ここで、MyBloc
は提供するBlocのインスタンスを生成し、MyWidget
はBlocにアクセスするウィジェットです。