Collection of my personal live templates for Flutter, BLoC, freezed or LogX library.
For using in your Android Studio see this StackOverflow answer.
const $class$($END$);
const SizedBox(width: $width$)$END$
const SizedBox(height: $height$)$END$
Automatically fills in class and method name of current context.
print('[$name$] $END$');
Use Surround With functionality in Android Studio to wrap currently selected text with setState
.
setState(() {
$SELECTION$
});
BlocBuilder<$bloc$, $state$>(
builder: (context, state) {
$END$
},
)
class $NAME$ extends StatelessWidget {
const $NAME$();
@override
Widget build(BuildContext context) {
return $END$;
}
}
BlocConsumer<$bloc$, $state$>(
listener: (context, state) {
},
builder: lightTheme(context, state) {
$END$
},
)
import 'package:flutter_bloc/flutter_bloc.dart';
BlocListener<$bloc$, $state$>(
listener: (context, state) {
$END$
},
)
import 'package:flutter_bloc/flutter_bloc.dart';
class $name$ extends Bloc<$event$, $state$> {
$name$() : super($initialState$);
@override
Stream<$state$> mapEventToState($event$ event) async* {
$END$
}
}
import 'package:flutter_bloc/flutter_bloc.dart';
class $name$ extends Cubit<$state$> {
$name$() : super($initialState$);
$END$
}
const factory $class$.$name$($END$) = _$class$$nameCap$;
const factory $class$.$name$($END$) = $class$$nameCap$;
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part '$file$.freezed.dart';
$END$
@freezed
abstract class $name$ with _$$$name$ {
$END$
}
Automatically fills in class and method name of current scope. Remember to import logx package
Log.d('$text$', name: '$name$');