I have a dynamic x and I would like to assign x to T s if x is T, and otherwise assign null to s. S
dynamic x
x
T s
x is T
null
s
Just use the as keyword
final tweet = tweets[index] as Tweet;