mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-06 07:29:42 +00:00
170 lines
4.8 KiB
Plaintext
170 lines
4.8 KiB
Plaintext
{
|
|
"PaginatedState": {
|
|
"scope": "dart",
|
|
"prefix": "paginatedState",
|
|
"description": "Generate a PaginatedState",
|
|
"body": [
|
|
"class ${1:Model}State extends PaginatedState<${2:Model}> {",
|
|
" ${1:Model}State({",
|
|
" required super.items,",
|
|
" required super.offset,",
|
|
" required super.limit,",
|
|
" required super.hasMore,",
|
|
" });",
|
|
" ",
|
|
" @override",
|
|
" ${1:Model}State copyWith({",
|
|
" List<${2:Model}>? items,",
|
|
" int? offset,",
|
|
" int? limit,",
|
|
" bool? hasMore,",
|
|
" }) {",
|
|
" return ${1:Model}State(",
|
|
" items: items ?? this.items,",
|
|
" offset: offset ?? this.offset,",
|
|
" limit: limit ?? this.limit,",
|
|
" hasMore: hasMore ?? this.hasMore,",
|
|
" );",
|
|
" }",
|
|
"}"
|
|
]
|
|
},
|
|
"PaginatedAsyncNotifier": {
|
|
"scope": "dart",
|
|
"prefix": "paginatedAsyncNotifier",
|
|
"description": "Generate a PaginatedAsyncNotifier",
|
|
"body": [
|
|
"class ${1:NotifierName}Notifier extends PaginatedAsyncNotifier<${3:Item}, ${2:Model}State> {",
|
|
" ${1:NotifierName}Notifier() : super();",
|
|
" ",
|
|
" @override",
|
|
" fetch(int offset, int limit) async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
" ",
|
|
" @override",
|
|
" build() async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
"}"
|
|
]
|
|
},
|
|
"PaginaitedNotifierWithState": {
|
|
"scope": "dart",
|
|
"prefix": "paginatedNotifierWithState",
|
|
"description": "Generate a PaginatedNotifier with PaginatedState",
|
|
"body": [
|
|
"class $1State extends PaginatedState<$2> {",
|
|
" $1State({",
|
|
" required super.items,",
|
|
" required super.offset,",
|
|
" required super.limit,",
|
|
" required super.hasMore,",
|
|
" });",
|
|
" ",
|
|
" @override",
|
|
" $1State copyWith({",
|
|
" List<$2>? items,",
|
|
" int? offset,",
|
|
" int? limit,",
|
|
" bool? hasMore,",
|
|
" }) {",
|
|
" return $1State(",
|
|
" items: items ?? this.items,",
|
|
" offset: offset ?? this.offset,",
|
|
" limit: limit ?? this.limit,",
|
|
" hasMore: hasMore ?? this.hasMore,",
|
|
" );",
|
|
" }",
|
|
"}",
|
|
" ",
|
|
"class $1Notifier",
|
|
" extends PaginatedAsyncNotifier<$2, $1State> {",
|
|
" $1Notifier() : super();",
|
|
" ",
|
|
" @override",
|
|
" fetch(int offset, int limit) async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
" ",
|
|
" @override",
|
|
" build() async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
"}",
|
|
" ",
|
|
"final ${1/(.*)/${1:/camelcase}/}Provider = AsyncNotifierProvider<$1Notifier, $1State>(",
|
|
" ()=> $1Notifier(),",
|
|
");"
|
|
]
|
|
},
|
|
"FamilyPaginatedAsyncNotifier": {
|
|
"scope": "dart",
|
|
"prefix": "familyPaginatedAsyncNotifier",
|
|
"description": "Generate a FamilyPaginatedAsyncNotifier",
|
|
"body": [
|
|
"class ${1:NotifierName}Notifier extends FamilyPaginatedAsyncNotifier<${3:Item}, ${2:Model}State, {$4:Arg}> {",
|
|
" ${1:NotifierName}Notifier() : super();",
|
|
" ",
|
|
" @override",
|
|
" fetch(arg, offset, limit) async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
" ",
|
|
" @override",
|
|
" build(arg) async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
"}"
|
|
]
|
|
},
|
|
"FamilyPaginaitedNotifierWithState": {
|
|
"scope": "dart",
|
|
"prefix": "familyPaginatedNotifierWithState",
|
|
"description": "Generate a FamilyPaginatedAsyncNotifier with PaginatedState",
|
|
"body": [
|
|
"class $1State extends PaginatedState<$2> {",
|
|
" $1State({",
|
|
" required super.items,",
|
|
" required super.offset,",
|
|
" required super.limit,",
|
|
" required super.hasMore,",
|
|
" });",
|
|
" ",
|
|
" @override",
|
|
" $1State copyWith({",
|
|
" List<$2>? items,",
|
|
" int? offset,",
|
|
" int? limit,",
|
|
" bool? hasMore,",
|
|
" }) {",
|
|
" return $1State(",
|
|
" items: items ?? this.items,",
|
|
" offset: offset ?? this.offset,",
|
|
" limit: limit ?? this.limit,",
|
|
" hasMore: hasMore ?? this.hasMore,",
|
|
" );",
|
|
" }",
|
|
"}",
|
|
" ",
|
|
"class $1Notifier",
|
|
" extends FamilyPaginatedAsyncNotifier<$2, $1State, $3> {",
|
|
" $1Notifier() : super();",
|
|
" ",
|
|
" @override",
|
|
" fetch(arg, offset, limit) async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
" ",
|
|
" @override",
|
|
" build(arg) async {",
|
|
" throw UnimplementedError();",
|
|
" }",
|
|
"}",
|
|
" ",
|
|
"final ${1/(.*)/${1:/camelcase}/}Provider = AsyncNotifierProviderFamily<$1Notifier, $1State, $3>(",
|
|
" ()=> $1Notifier(),",
|
|
");"
|
|
]
|
|
},
|
|
} |