//[docs](../../index.md)/[dev.inmo.tgbotapi.extensions.behaviour_builder.expectations](index.md)/[expectFlow](expect-flow.md) # expectFlow [common] Content suspend fun <[T](expect-flow.md)> [FlowsUpdatesFilter](../dev.inmo.tgbotapi.updateshandlers/-flows-updates-filter/index.md).[expectFlow](expect-flow.md)(bot: [TelegramBot](../dev.inmo.tgbotapi.bot/index.md#%5Bdev.inmo.tgbotapi.bot%2FTelegramBot%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081), initRequest: [Request](../dev.inmo.tgbotapi.requests.abstracts/-request/index.md)<*>? = null, count: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)? = null, errorFactory: [NullableRequestBuilder](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder.expectations%2FNullableRequestBuilder%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<*> = { null }, cancelRequestFactory: [NullableRequestBuilder](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder.expectations%2FNullableRequestBuilder%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<*> = { null }, cancelTrigger: suspend ([Update](../dev.inmo.tgbotapi.types.update.abstracts/-update/index.md)) -> [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = { cancelRequestFactory(it) != null }, filter: suspend ([Update](../dev.inmo.tgbotapi.types.update.abstracts/-update/index.md)) -> [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[T](expect-flow.md)>): <[T](expect-flow.md)> More info ## Parameters common | | | |---|---| | initRequest|

If not null, this request will be sent by [bot](expect-flow.md) before returning value

| | count|

If set, result will return [count](expect-flow.md) elements on each

| | errorFactory|

If set, this factory will be used to produce requests in case when user have sent incorrect data

| | cancelRequestFactory|

If set, this factory will be used to produce requests in case when it is required to say user that chain of scenario has been cancelled

| | cancelTrigger|

When this trigger returns true, chain is cancelled

| | filter|

It is main param, which will be called on each update. When it return not null, result will be returned as is, but when it returns null, then will be called [cancelTrigger](expect-flow.md) (if it will return true - [cancelRequestFactory](expect-flow.md) will be called too), [errorFactory](expect-flow.md) and then will be returned null

| [common] Content suspend fun <[T](expect-flow.md)> [BehaviourContext](../dev.inmo.tgbotapi.extensions.behaviour_builder/-behaviour-context/index.md).[expectFlow](expect-flow.md)(initRequest: [Request](../dev.inmo.tgbotapi.requests.abstracts/-request/index.md)<*>? = null, count: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)? = null, errorFactory: [NullableRequestBuilder](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder.expectations%2FNullableRequestBuilder%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<*> = { null }, cancelRequestFactory: [NullableRequestBuilder](index.md#%5Bdev.inmo.tgbotapi.extensions.behaviour_builder.expectations%2FNullableRequestBuilder%2F%2F%2FPointingToDeclaration%2F%5D%2FClasslikes%2F625018081)<*> = { null }, cancelTrigger: suspend ([Update](../dev.inmo.tgbotapi.types.update.abstracts/-update/index.md)) -> [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = { cancelRequestFactory(it) != null }, filter: suspend ([Update](../dev.inmo.tgbotapi.types.update.abstracts/-update/index.md)) -> [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[T](expect-flow.md)>): <[T](expect-flow.md)> More info ## Parameters common | | | |---|---| | initRequest|

If not null, this request will be sent by bot before returning value

| | count|

If set, result will return [count](expect-flow.md) elements on each

| | errorFactory|

If set, this factory will be used to produce requests in case when user have sent incorrect data

| | cancelRequestFactory|

If set, this factory will be used to produce requests in case when it is required to say user that chain of scenario has been cancelled

| | cancelTrigger|

When this trigger returns true, chain is cancelled

| | filter|

It is main param, which will be called on each update. When it return not null, result will be returned as is, but when it returns null, then will be called [cancelTrigger](expect-flow.md) (if it will return true - [cancelRequestFactory](expect-flow.md) will be called too), [errorFactory](expect-flow.md) and then will be returned null

|