Skip to content

Instantly share code, notes, and snippets.

@brandondiamond
brandondiamond / is_fixed_extent_list_borked.dart
Last active September 25, 2019 20:46
Test illustrating potential bug in how scroll offset corrections are calculated in sliver_fixed_extent_list.dart
/////////////// Background ///////////////
/*
(The test case that appears below may do a better job of explaning than this wall of text :)
I recently noticed this calculation while investigating some framework code:
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart#L235
There's an associated test case, and though it makes sense, I think it misses a potential issue:
https://github.com/flutter/flutter/blob/master/packages/flutter/test/widgets/slivers_evil_test.dart#L255
@brandondiamond
brandondiamond / ninexample.cpp
Created December 28, 2011 15:10
An example of using arrays and $nin with the MongoDB C++ driver
/* Copyright 2009 10gen Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
import 'package:flutter/material.dart';
class RootOverlayInjector extends Overlay {
final Widget child;
const RootOverlayInjector({Key key, this.child})
: super(key: key, initialEntries: const []);
@override
_RootOverlayInjectorState createState() => _RootOverlayInjectorState();
@brandondiamond
brandondiamond / broken_mixin.dart
Created June 10, 2020 23:33
Reproducing incompatible signature bug
class Built<T extends Built<T, S>, S extends Builder<T, S>> {
}
class Builder<T extends Built<T, S>, S extends Builder<T, S>> {
}
class StatefulWidget {
@brandondiamond
brandondiamond / self_collision.dart
Created June 11, 2020 15:55
Simpler reproduction of self-collision bug
class Pair<T extends Pair<T, S>, S extends Pair<T, S>> {}
mixin BrokenMixin<T extends Pair<T, S>, S extends Pair<T, S>> {
void broken<V extends Pair<V, W>, W extends Pair<V, W>>([void Function(T, V) func]) {}
}
class Example with BrokenMixin<Null, Null> {}
main() {
Example().broken<Null, Null>();
class Identifiable<T> {
Id<T> id;
}
class Id<T> {}
class Person extends Identifiable<Person> {}
class Animal extends Identifiable<Animal> {}