LongPolling class
A class that handles long polling. This class is used to fetch updates from the Telegram API. It uses the long polling method.
Constructors
-
LongPolling({int offset = 0, int timeout = 30, int limit = 100, List<
UpdateType> ? allowedUpdates, Duration delayDuration = const Duration(milliseconds: 200)}) - Constructs a new LongPolling object.
Properties
-
allowedUpdates
→ List<
UpdateType> ? -
A list of update types to fetch.
final
- api ↔ RawAPI
-
Raw API instance.
latefinalinherited
- delayDuration → Duration
-
Delay time between each long polling request.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Flag to check if the long polling is active.
no setteroverride
- isPolling → bool
-
Returns the status of the long polling.
no setter
- limit → int
-
The maximum number of updates to fetch.
final
- offset ↔ int
-
The offset of the next update to fetch.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → int
-
The timeout of the long polling request.
final
Methods
-
addUpdate(
Update update) → void -
Emit new update into the stream.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onError(
FutureOr< void> onError(BotError err)) → void -
Sets the error handler for long polling.
inherited
-
onUpdate(
) → Stream< Update> -
Handler for new updates.
inherited
-
setApi(
RawAPI api) → void -
Sets the Raw API instance.
inherited
-
start(
) → Future< void> -
Starts the long polling.
override
-
stop(
) → Future< void> -
Stops the long polling.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
allUpdates(
{int offset = 0, int timeout = 30, int limit = 100, Duration delayDuration = const Duration(milliseconds: 200)}) → LongPolling - LongPolling with all updates allowed.
Constants
- maxTimeout → const int
- The maximum timeout allowed by the Telegram API.