-
Notifications
You must be signed in to change notification settings - Fork 146
feat: Flutter SDK update for version 20.0.0 #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
bff2a5e
25c9e27
b65eb3f
f383097
5d2b2cd
acd8e68
fb8dfa8
1b01247
3270ee7
094bb89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| part of '../../enums.dart'; | ||
|
|
||
| enum ExecutionStatus { | ||
| waiting(value: 'waiting'), | ||
| processing(value: 'processing'), | ||
| completed(value: 'completed'), | ||
| failed(value: 'failed'); | ||
|
|
||
| const ExecutionStatus({required this.value}); | ||
|
|
||
| final String value; | ||
|
|
||
| String toJson() => value; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| part of '../../enums.dart'; | ||
|
|
||
| enum ExecutionTrigger { | ||
| http(value: 'http'), | ||
| schedule(value: 'schedule'), | ||
| event(value: 'event'); | ||
|
|
||
| const ExecutionTrigger({required this.value}); | ||
|
|
||
| final String value; | ||
|
|
||
| String toJson() => value; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,10 +21,10 @@ class Execution implements Model { | |||||||||||||||||||||||||||||||||||||||||||||
| final String deploymentId; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. | ||||||||||||||||||||||||||||||||||||||||||||||
| final String trigger; | ||||||||||||||||||||||||||||||||||||||||||||||
| final enums.ExecutionTrigger trigger; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. | ||||||||||||||||||||||||||||||||||||||||||||||
| final String status; | ||||||||||||||||||||||||||||||||||||||||||||||
| final enums.ExecutionStatus status; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /// HTTP request method type. | ||||||||||||||||||||||||||||||||||||||||||||||
| final String requestMethod; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -85,8 +85,12 @@ class Execution implements Model { | |||||||||||||||||||||||||||||||||||||||||||||
| $permissions: List.from(map['\$permissions'] ?? []), | ||||||||||||||||||||||||||||||||||||||||||||||
| functionId: map['functionId'].toString(), | ||||||||||||||||||||||||||||||||||||||||||||||
| deploymentId: map['deploymentId'].toString(), | ||||||||||||||||||||||||||||||||||||||||||||||
| trigger: map['trigger'].toString(), | ||||||||||||||||||||||||||||||||||||||||||||||
| status: map['status'].toString(), | ||||||||||||||||||||||||||||||||||||||||||||||
| trigger: enums.ExecutionTrigger.values.firstWhere( | ||||||||||||||||||||||||||||||||||||||||||||||
| (e) => e.value == map['trigger'], | ||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||
| status: enums.ExecutionStatus.values.firstWhere( | ||||||||||||||||||||||||||||||||||||||||||||||
| (e) => e.value == map['status'], | ||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle unknown enum values explicitly to avoid opaque StateError firstWhere without orElse throws StateError on unknown/nullable values. Emit a clear error (or use the enum’s fromJson helper if added). Apply this diff: - trigger: enums.ExecutionTrigger.values.firstWhere(
- (e) => e.value == map['trigger'],
- ),
- status: enums.ExecutionStatus.values.firstWhere(
- (e) => e.value == map['status'],
- ),
+ trigger: enums.ExecutionTrigger.values.firstWhere(
+ (e) => e.value == map['trigger'],
+ orElse: () => throw ArgumentError.value(
+ map['trigger'],
+ 'trigger',
+ 'Unknown ExecutionTrigger',
+ ),
+ ),
+ status: enums.ExecutionStatus.values.firstWhere(
+ (e) => e.value == map['status'],
+ orElse: () => throw ArgumentError.value(
+ map['status'],
+ 'status',
+ 'Unknown ExecutionStatus',
+ ),
+ ),If you add enums’ fromJson as suggested, prefer: - trigger: enums.ExecutionTrigger.values.firstWhere( ... ),
- status: enums.ExecutionStatus.values.firstWhere( ... ),
+ trigger: enums.ExecutionTrigger.fromJson(map['trigger']),
+ status: enums.ExecutionStatus.fromJson(map['status']),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| requestMethod: map['requestMethod'].toString(), | ||||||||||||||||||||||||||||||||||||||||||||||
| requestPath: map['requestPath'].toString(), | ||||||||||||||||||||||||||||||||||||||||||||||
| requestHeaders: List<Headers>.from( | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -112,8 +116,8 @@ class Execution implements Model { | |||||||||||||||||||||||||||||||||||||||||||||
| "\$permissions": $permissions, | ||||||||||||||||||||||||||||||||||||||||||||||
| "functionId": functionId, | ||||||||||||||||||||||||||||||||||||||||||||||
| "deploymentId": deploymentId, | ||||||||||||||||||||||||||||||||||||||||||||||
| "trigger": trigger, | ||||||||||||||||||||||||||||||||||||||||||||||
| "status": status, | ||||||||||||||||||||||||||||||||||||||||||||||
| "trigger": trigger.value, | ||||||||||||||||||||||||||||||||||||||||||||||
| "status": status.value, | ||||||||||||||||||||||||||||||||||||||||||||||
| "requestMethod": requestMethod, | ||||||||||||||||||||||||||||||||||||||||||||||
| "requestPath": requestPath, | ||||||||||||||||||||||||||||||||||||||||||||||
| "requestHeaders": requestHeaders.map((p) => p.toMap()).toList(), | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipped a version