This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum A { foo, bar } | |
enum B { foo, bar, baz } | |
void main() { | |
final x = A.foo; | |
print(x == B.foo ? '$x == B.foo' : '$x != B.foo'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Factory<T> { | |
Factory(this.createInstance); | |
final T Function() createInstance; | |
} | |
T produce<T>(Factory<T> factory) { | |
return factory.createInstance(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_hooks/flutter_hooks.dart'; | |
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
final streamController = StreamController<String>(); | |
final provider1 = StreamProvider<String>((_) => streamController.stream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What do you think will be the output of this program? | |
class Base { | |
void foo() { | |
print("Base.foo()"); | |
} | |
} | |
mixin FooMixin on Base { | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Writable} from "stream" | |
class WritableBuffer extends Writable { | |
private _chunks: Array<Buffer> = [] | |
_write(chunk: Buffer, encoding: "buffer", callback: (error?: Error) => void): void { | |
this._chunks.push(chunk) | |
callback() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Transform} from "stream" | |
class CountBytesStream extends Transform { | |
counter = 0 | |
finished = false | |
_transform(chunk: Buffer, encoding: "buffer", callback: Function): void { | |
this.counter += chunk.byteLength | |
callback(null, chunk) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.googlecode.junittoolbox.ParallelRunner; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
/** | |
* Because this class uses the {@link ParallelRunner}, | |
* the test methods are in parallel. | |
*/ | |
@RunWith(ParallelRunner.class) | |
public class TestClass1 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.internal.AssumptionViolatedException; | |
import org.junit.runners.BlockJUnit4ClassRunner; | |
import org.junit.runners.model.FrameworkMethod; | |
import org.junit.runners.model.InitializationError; | |
import org.junit.runners.model.Statement; | |
import org.junit.runners.model.TestClass; | |
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; |