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
android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,android-25,build-tools-25.0.0 |
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 | |
# | |
# Autoformat all modified files before commit | |
# | |
function format_if_required { | |
FILES=$1 | |
flutter format $FILES | grep -Ev '^(Unchanged)' |
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 | |
# | |
# Autoformat all modified files before commit | |
# | |
function format_if_required { | |
FILES=$1 | |
flutter format $FILES | grep -Ev '^(Unchanged)' |
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
// Use language features to build the url | |
String buildUrlWithQueryParams(String url, Map<String, dynamic> queryParams) { | |
final uri = Uri.parse(url); | |
final fullUri = uri.replace( | |
queryParameters: { | |
...uri.queryParameters, | |
...queryParams, | |
}, | |
); |
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: PR Commenter | |
on: | |
pull_request: | |
types: [opened, reopened] | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: |
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 ScrollToTopDataObserver(val layoutManager: LinearLayoutManager, | |
val recyclerView: RecyclerView) | |
: RecyclerView.AdapterDataObserver() { | |
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) { | |
super.onItemRangeInserted(positionStart, itemCount) | |
val lastVisiblePosition = layoutManager.findLastCompletelyVisibleItemPosition() | |
// If the recycler view is initially being loaded or the user is at the bottom of the | |
// list, scroll to the bottom of the list to show the newly added message. | |
if (lastVisiblePosition == -1 || positionStart >= itemCount - 1 && lastVisiblePosition == positionStart - 1) { |
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'; | |
Future main() async { | |
print('start'); | |
final li = await Future.wait([fetch(4), fetch(6)]); | |
print('results: ${li[0]} ${li[1]}'); // results: 4 2 | |
final li2 = await Future.wait([fetch(6), fetch(3)]); | |
print('results 2: ${li2[0]} ${li2[1]}'); // results: 6 3 |
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 UpdateUserInteractor { | |
Future<void> call(String name) async { | |
print("done $name"); | |
return; | |
} | |
} | |
void main() async { | |
final updateUser = UpdateUserInteractor(); | |
await updateUser('Dan'); |
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
/// | |
/// The Result Monad | |
/// | |
abstract class Result<T> { | |
bool isSuccess() { | |
return this is Success; | |
} | |
Success<T> asSuccess() { |
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
<EditText ... | |
android:clickable="true" | |
android:cursorVisible="false" | |
android:focusable="false"/> |