Skip to content

Instantly share code, notes, and snippets.

@enzoz
Created October 7, 2025 14:50
Show Gist options
  • Select an option

  • Save enzoz/2df61039ebcb0950faceb51a22576fe1 to your computer and use it in GitHub Desktop.

Select an option

Save enzoz/2df61039ebcb0950faceb51a22576fe1 to your computer and use it in GitHub Desktop.
compare-list-spread.dart
import 'package:flutter/foundation.dart';
void main() {
const lista = [1, 2, 3, 4, 5, 6];
final withSpread = [...[...lista.take(3)]];
final withoutSpread = [...lista.take(3)];
print("withSpread $withSpread");
print("withoutSpread $withoutSpread");
print("Is the same? ${listEquals(withSpread, withoutSpread)}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment