Dart Runes followedBy()
Syntax & Examples
Runes.followedBy() method
The `followedBy` method in Dart returns the lazy concatenation of this iterable and another iterable.
Syntax of Runes.followedBy()
The syntax of Runes.followedBy() method is:
Iterable<int> followedBy(Iterable<int> other)
This followedBy() method of Runes returns the lazy concatentation of this iterable and other
.
Parameters
Parameter | Optional/Required | Description |
---|---|---|
other | required | Another iterable to concatenate with this iterable. |
Return Type
Runes.followedBy() returns value of type Iterable<int>
.
✐ Examples
1 Concatenate two sequences of characters
In this example,
- We create two sequences of Unicode code points,
first
andsecond
, from the strings 'Hello' and ' World' respectively. - We use the
followedBy
method to concatenate the two sequences. - We then print the combined sequence to standard output.
Dart Program
void main() {
Runes first = Runes('Hello');
Runes second = Runes(' World');
Iterable<int> combined = first.followedBy(second);
print('Combined sequence: $combined');
}
Output
Combined sequence: (72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100)
2 Concatenate sequence of numbers with a list of numbers
In this example,
- We create a sequence of Unicode code points
numbers
from the string '12345'. - We create a list
moreNumbers
containing numbers 6 to 10. - We use the
followedBy
method to concatenate the sequence with the list. - We then print the combined sequence to standard output.
Dart Program
void main() {
Runes numbers = Runes('12345');
List<int> moreNumbers = [6, 7, 8, 9, 10];
Iterable<int> combined = numbers.followedBy(moreNumbers);
print('Combined sequence: $combined');
}
Output
Combined sequence: (49, 50, 51, 52, 53, 6, 7, 8, 9, 10)
Summary
In this Dart tutorial, we learned about followedBy() method of Runes: the syntax and few working examples with output and detailed explanation for each example.