Skip to content

Commit e534efc

Browse files
authored
Merge pull request #7 from sinadarvi/patch-1
adding BehaviorSubject
2 parents 3e94464 + 0c556c7 commit e534efc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Awesome Flutter Snippets is a collection of commonly used Flutter classes and me
3333
| `mounted` | Mounted | Whether this State object is currently in a tree. |
3434
| `snk` | Sink | A Sink is the input of a stream. |
3535
| `strm` | Stream | A source of asynchronous data events. A stream can be of any data type. |
36+
| `subj` | Subject | A BehaviorSubject is also a broadcast StreamController which returns an Observable rather than a Stream. |
3637
| `toStr` | To String | Returns a string representation of this object. |
3738
| `debugP` | Debug Print | Prints a message to the console, which you can access using the flutter tool's `logs` command (flutter logs). |
3839
| `importM` | Material Package | Import Material package.

snippets/snippets.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,14 @@
297297
],
298298
"description": "A source of asynchronous data events. A stream can be of any data type <T>"
299299
},
300+
"Subject": {
301+
"prefix": "subj",
302+
"body": [
303+
"Stream<${1:type}> get ${2:name} => _${2:name}Subject.stream;",
304+
"final _${2:name}Subject = BehaviorSubject<${1:type}>();"
305+
],
306+
"description": "A BehaviorSubject is also a broadcast StreamController which returns an Observable rather than a Stream."
307+
},
300308
"toString": {
301309
"prefix": "toStr",
302310
"body": [
@@ -380,4 +388,4 @@
380388
"}"
381389
]
382390
}
383-
}
391+
}

0 commit comments

Comments
 (0)