Skip to content

Instantly share code, notes, and snippets.

@JavierPerezLavadie
JavierPerezLavadie / firebase_storage_web.dart
Created November 17, 2023 23:13 — forked from ialhashim/firebase_storage_web.dart
Flutter + Firebase storage on the web, work around
// Note this is just a workaround until the offical support of web
// We would need to add these as well
//// ignore_for_file: avoid_web_libraries_in_flutter
//import 'dart:html';
//import 'package:mime/mime.dart';
//import 'package:firebase/firebase.dart' as fb;
// Some upload button is pressed
onPressed: () async {
@JavierPerezLavadie
JavierPerezLavadie / big_o.dart
Created August 11, 2022 08:37 — forked from montyr75/big_o.dart
Big O notation, with Dart examples.
// O(1)
// constant
bool isFirstElementNull(List<String> elements) {
return elements.first == null;
}
// O(n)
// growth is linear in direct proportion to the size of the data set
bool containsValue(List<String> elements, String value) {
for (String element in elements) {
@JavierPerezLavadie
JavierPerezLavadie / paginate.dart
Created June 26, 2022 13:47 — forked from mubasshir/paginate.dart
Dart Array Pagination
void main() {
List arr = [];
for (int i = 0; i < 100; i++) {
arr.add(i.toString());
}
int page = 1;
var startIndex = -1, endIndex = -1;
while (arr.length > 0 && endIndex != (arr.length - 1)) {
startIndex = (page - 1) * 10;