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
// Copyright 2016 The Chromium Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_markdown/flutter_markdown.dart' show SyntaxHighlighter; | |
import 'package:string_scanner/string_scanner.dart'; | |
class SyntaxHighlighterStyle { | |
SyntaxHighlighterStyle( |
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
// MIT License | |
// | |
// Copyright (c) 2019 Simon Lightfoot | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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
/// found nothing better than this | |
/// https://github.com/flutter/flutter/blob/master/packages/flutter/test/widgets/hyperlink_test.dart#L47 | |
/// sooo... | |
extension WidgetTesterRichEditExtension on WidgetTester { | |
Iterable<InlineSpan> findTextSpans( | |
Finder richTextFinder, bool Function(InlineSpan) predicate) { | |
final richText = widget<RichText>(richTextFinder); | |
expect(richText.text, isInstanceOf<TextSpan>()); | |
final TextSpan innerText = richText.text; | |
return innerText.children.where(predicate); |
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 io.flutter.embedding.android.FlutterActivity // there are two FlutterActivities :| | |
import io.flutter.plugins.GeneratedPluginRegistrant // this is not seen by IntelliJ by works ¯\_(ツ)_/¯ | |
typealias FlutterCallback = (methodCall: MethodCall, result: MethodChannel.Result) -> Unit | |
class FlutterPathActivity : FlutterActivity() { | |
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | |
infix fun String.handles(callHandler: FlutterCallback) { | |
MethodChannel(flutterEngine.dartExecutor, this).setMethodCallHandler(callHandler) | |
} |
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
// MIT License | |
// | |
// Copyright (c) 2019 Lukasz Wisniewski | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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
#!/bin/sh | |
# Makes the bash script to print out every command before it is executed except echo | |
trap '[[ $BASH_COMMAND != echo* ]] && echo $BASH_COMMAND' DEBUG | |
echo "Executing steps to repro issue #37852" | |
echo "https://github.com/flutter/flutter/issues/37852" | |
echo "MAKE SURE YOU'RE ON MASTER CHANNEL!" | |
echo "MAKE SURE YOU HAVE iOS SIMULATOR RUNNING" |
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
name: my_flutter | |
description: A new flutter module project. | |
# The following defines the version and build number for your application. | |
# A version number is three numbers separated by dots, like 1.2.43 | |
# followed by an optional build number separated by a +. | |
# Both the version and the builder number may be overridden in flutter | |
# build by specifying --build-name and --build-number, respectively. | |
# In Android, build-name is used as versionName while build-number used as versionCode. | |
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning |
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 SuspendedVariable<T>(var scope: CoroutineScope? = GlobalScope) { | |
private var actor = scope?.actor<Op<T>> { | |
var value : T? = null | |
val deferrals = mutableListOf<CompletableDeferred<T>>() | |
try { | |
for (message in channel) { | |
when (message) { | |
is Op.Set -> { |
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
/** | |
* kinda like `lateinit var` but if it's really late it will make you wait rather than crash. | |
*/ | |
class SuspendedVariable<T> { | |
private val callbacks = mutableListOf<((T) -> Unit)>() | |
private var value: T? = null | |
fun set(t: T) { | |
value = t | |
if (t != null) { |
NewerOlder