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:math' as math; | |
import 'package:flutter/rendering.dart'; | |
import 'package:flutter/widgets.dart'; | |
class SliverFloatingHeader extends SingleChildRenderObjectWidget { | |
const SliverFloatingHeader({ | |
Key key, | |
Widget child, | |
}) : super(key: key, child: child); |
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
# Check https://dart-lang.github.io/linter/lints/ for lint rules documentation | |
# Update from http://dart-lang.github.io/linter/lints/options/options.html | |
analyzer: | |
errors: | |
missing_required_param: error | |
missing_return: error | |
todo: ignore | |
language: | |
strict-inference: true |
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 'package:flutter/material.dart'; | |
void main() { | |
// Displays build timeline | |
debugProfileBuildsEnabled = true; | |
runApp(GlobalKeyWidget()); | |
} | |
class WidgetsWithKeysAreJustUpdated extends StatefulWidget { |
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
package com.tomek | |
abstract class Animal(val size: Int) | |
class Dog(val cuteness: Int): Animal(100) | |
class Spider(val terrorFactor: Int): Animal(1) | |
// Covariance |
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
╔══════════╦═════════════════╦═══════════════╦═══════════════╗ | |
║ Function ║ Receiver (this) ║ Argument (it) ║ Result ║ | |
╠══════════╬═════════════════╬═══════════════╬═══════════════╣ | |
║ let ║ this@MyClass ║ String("...") ║ Int(42) ║ | |
║ run ║ String("...") ║ N\A ║ Int(42) ║ | |
║ run* ║ this@MyClass ║ N\A ║ Int(42) ║ | |
║ with* ║ String("...") ║ N\A ║ Int(42) ║ | |
║ apply ║ String("...") ║ N\A ║ String("...") ║ | |
║ also ║ this@MyClass ║ String("...") ║ String("...") ║ | |
╚══════════╩═════════════════╩═══════════════╩═══════════════╝ |
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 android.annotation.SuppressLint | |
import android.os.Parcelable | |
import kotlinx.android.parcel.Parcelize | |
@SuppressLint("ParcelCreator") // IntelliJ Issue https://youtrack.jetbrains.com/issue/KT-19300 | |
@Parcelize | |
data class Movie(val title: String) : Parcelable |
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
final String? text; | |
@override | |
Widget build(BuildContext context) { | |
final _text = text; // Assign field to local final variable | |
return Column( | |
children: [ | |
if (_text != null) Text(_text), // The `!` is not longer needed | |
], | |
); |
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
void main() { | |
final A example = B(); | |
if (example.text != null) { | |
print(example.text!.length); // Throws null reference exception | |
} | |
} |
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 A { | |
A(this.text); | |
final String? text; // Final field | |
} | |
class B implements A { | |
bool _first = true; | |
@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
final String? text; | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: [ | |
if (text != null) Text(text!), // Won't compile without `!` in `text!` | |
], | |
); | |
} |
NewerOlder