Closed ianjaspersantos closed 4 years ago
This package is specific to Dart extensions, flutter extensions should be added to "FlutterX".
The repository link is currently broken, @leisim will be able to guide you more on this.
I'm using this extension in my projects
import 'package:flutter/widgets.dart';
import 'package:dartx/dartx.dart';
extension WidgetListExt on Iterable<Widget> {
/// adds widgets between the elements
List<Widget> dividedWith(Widget divider) {
final elements = flatMap((it) => [it, divider]).toList();
// remove last divider
return elements.dropLast(1);
}
}
Thanks for the answer. :) But somewhat somehow I think its relevant to dartx as it should be flexible as possible like the use case below:
final words = <String>[
'Hello',
'Flutter',
'Community',
];
//Accepted value should be based on the generic class type passed
final newWords = words.dividedWith(' ');
But ill the extension you provided. Thank you!
@ianjaspersantos You can use Iterable
Is there any way I can achieve this using this packages easily? Thanks