Skip to content

Collection of my personal live templates for Flutter, BLoC, freezed or LogX library.

Notifications You must be signed in to change notification settings

vaetas/flutter-extended-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Flutter Extended Live Templates For Android Studio

Collection of my personal live templates for Flutter, BLoC, freezed or LogX library.

For using in your Android Studio see this StackOverflow answer.

Flutter

cc: const constructor

const $class$($END$);

gaph: horizontal SizedBox

const SizedBox(width: $width$)$END$

gapv: vertical SizedBox

const SizedBox(height: $height$)$END$

printx: extended print

Automatically fills in class and method name of current context.

print('[$name$] $END$');

st: setState

Use Surround With functionality in Android Studio to wrap currently selected text with setState.

setState(() {
  $SELECTION$
});

BLoC

blb: BlocBuilder

BlocBuilder<$bloc$, $state$>(
    builder: (context, state) {
        $END$
    },
)

cstless: const StatelessWidget

class $NAME$ extends StatelessWidget {
  const $NAME$();
  
  @override
  Widget build(BuildContext context) {
    return $END$;
  }
}

blc: BlocConsumer

BlocConsumer<$bloc$, $state$>(
    listener: (context, state) {
    
    },
    builder:  lightTheme(context, state) {
        $END$
    },
)

blimport: BLoC import

import 'package:flutter_bloc/flutter_bloc.dart';

bll: BlocListener

BlocListener<$bloc$, $state$>(
    listener: (context, state) {
        $END$
    },
)

bloc: BLoC

import 'package:flutter_bloc/flutter_bloc.dart';

class $name$ extends Bloc<$event$, $state$> {
  $name$() : super($initialState$);

  @override
  Stream<$state$> mapEventToState($event$ event) async* {
    $END$
  }
}

cubit: Cubit

import 'package:flutter_bloc/flutter_bloc.dart';

class $name$ extends Cubit<$state$> {
  $name$() : super($initialState$);

  $END$
}

freezed

cf: const factory constructor

const factory $class$.$name$($END$) = _$class$$nameCap$;

cpf: const public factory constructor

const factory $class$.$name$($END$) = $class$$nameCap$;

fimport: freezed import

import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part '$file$.freezed.dart';

$END$

funion: freezed union

@freezed
abstract class $name$ with _$$$name$ {
  $END$
}

LogX

logx: static LogX log

Automatically fills in class and method name of current scope. Remember to import logx package

Log.d('$text$', name: '$name$');

About

Collection of my personal live templates for Flutter, BLoC, freezed or LogX library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published