Snippets Collections
import 'package:flutter/material.dart';

class AppContext {
  static BuildContext? _context;

  static void set(BuildContext context) {
    _context = context;
  }

  static BuildContext get() {
    return _context!;
  }
}
import 'package:cryptocornars/common/utils/app_context.dart';
import 'package:cryptocornars/constants/global_variable.dart';
import 'package:flutter/material.dart';

class Toast {
  static void show(String msg, BuildContext context, double height) {
    Color textColor = Colors.white;
    Color backgroundColor = Colors.blueAccent;
    dismiss();
    Toast._createView(msg, context, backgroundColor, textColor, height);
  }

  static OverlayEntry? _overlayEntry;
  static bool isVisible = false;


  static void _createView(String msg, BuildContext context, Color background,

      Color textColor, double height) async {
    var overlayState = Overlay.of(context);
    AppContext.get();
    final themeData = Theme.of(context);

    _overlayEntry = OverlayEntry(
      builder: (BuildContext context) => _ToastAnimatedWidget(
        height: height,
        child: SizedBox(
          width: MediaQuery.of(context).size.width,
          child: Container(
            alignment: Alignment.center,
            width: MediaQuery.of(context).size.width,
            child: Container(
              decoration: BoxDecoration(
                color: GlobalVariable.whiteSmoke,
                borderRadius: BorderRadius.circular(10),
              ),
              margin: const EdgeInsets.symmetric(horizontal: 20),
              padding: const EdgeInsets.fromLTRB(16, 10, 16, 10),
              child: Text(
                msg,
                style: themeData.textTheme.bodyLarge?.copyWith(
                  color: GlobalVariable.platinum,
                  fontFamily: 'Roboto',
                  fontSize: 16,
                  fontWeight: FontWeight.w500,
                ),
              ),
            ),
          ),
        ),
      ),
    );
    isVisible = true;
    overlayState.insert(_overlayEntry!);
  }

  static dismiss() async {
    if (!isVisible) {
      return;
    }
    isVisible = false;
    _overlayEntry?.remove();
  }
}

class _ToastAnimatedWidget extends StatefulWidget {
  const _ToastAnimatedWidget({
    Key? key,
    required this.child,
    required this.height,
  }) : super(key: key);
  final double height;
  final Widget child;

  @override
  _ToastWidgetState createState() => _ToastWidgetState();
}

class _ToastWidgetState extends State<_ToastAnimatedWidget>
    with SingleTickerProviderStateMixin {
  bool get _isVisible => true; //update this value later

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Positioned(
        bottom: widget.height,
        child: AnimatedOpacity(
          duration: const Duration(seconds: 2),
          opacity: _isVisible ? 1.0 : 0.0,
          child: widget.child,
        ));
  }
}
class _MyNavigationBarState extends State<MyNavigationBar > {
  int _currentTabIndex = 0;

  @override
  Widget build(BuildContext context) {
    final _kTabPages = <Widget>[
      Page1(),
      Page2(),
      Page3(),
      Container(),
    ];
    final _kBottmonNavBarItems = <BottomNavigationBarItem>[
      const BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
      const BottomNavigationBarItem(icon: Icon(Icons.network_cell), label: 'Prices'),
      const BottomNavigationBarItem(icon: Icon(Icons.add_circle), label: 'Trade'),
      const BottomNavigationBarItem(icon: Icon(Icons.account_balance_wallet), label: 'Wallet'),
    ];
    assert(_kTabPages.length == _kBottmonNavBarItems.length);
    final bottomNavBar = BottomNavigationBar(
      items: _kBottmonNavBarItems,
      currentIndex: _currentTabIndex,
      type: BottomNavigationBarType.fixed,
      onTap: (int index) {
        if(index == 3){
          showBottomSheet();
          return;
        }

        setState(() {
          _currentTabIndex = index;
        });
      },
    );
    return Scaffold(
      body: _kTabPages[_currentTabIndex],
      bottomNavigationBar: bottomNavBar,
      ),
    );
  }
}

showBottomSheet(){
      Container _buildBottomSheet(BuildContext context) {
    return Container(
      height: 300,
      padding: const EdgeInsets.all(8.0),
      decoration: BoxDecoration(
        border: Border.all(color: Colors.blue, width: 2.0),
        borderRadius: BorderRadius.circular(8.0),
      ),
      child: ListView(
        children: <Widget>[
          const ListTile(title: Text('Bottom sheet')),
          const TextField(
            keyboardType: TextInputType.number,
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              icon: Icon(Icons.attach_money),
              labelText: 'Enter an integer',
            ),
          ),
          Container(
            alignment: Alignment.center,
            child: ElevatedButton.icon(
              icon: const Icon(Icons.save),
              label: const Text('Save and close'),
              onPressed: () => Navigator.pop(context),
            ),
          )
        ],
      ),
    );
  }
}
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  final TextEditingController controller = TextEditingController();
  final _form = GlobalKey<FormState>();

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  bool isValid = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Container(
        margin: const EdgeInsets.all(10),
        child: Column(
          children: [
            Form(
              key: _form,
              child: FormField(
                validator: (val) =>
                    val == null || val == '' ? 'Type Something!' : null,
                builder: (formfielstate) {
                  return Column(
                    crossAxisAlignment: CrossAxisAlignment.end,
                     mainAxisSize: MainAxisSize.min,
                    children: [
                      TextField(
                        controller: controller,
                        decoration: const InputDecoration(labelText: 'Enter'),
                      ),
                      if (formfielstate.hasError)
                        Padding(
                          padding: const EdgeInsets.only(top: 10),
                          child: Text(
                            formfielstate.errorText!,
                            style: const TextStyle(color: Colors.red),
                          ),
                        ),

                    ],
                  );
                },
              ),
            ),
            Align(
              alignment: Alignment.center,
              child: ElevatedButton(
                onPressed: () {
                  if (_form.currentState!.validate()) {}
                },
                child: const Text('Click'),
              ),
            )
          ],
        ),
      ),
    );
  }
}
// TextFormField(
//                 controller: controller,
//                 decoration: const InputDecoration(
//                   errorStyle: TextStyle(
//                     textBaseline: TextBaseline.alphabetic
//                   ),
//                     hintText: 'Enter',
//                     border: OutlineInputBorder(
//                         borderSide: BorderSide(
//                       color: Colors.black38,
//                     )),
//                     enabledBorder: OutlineInputBorder(
//                         borderSide: BorderSide(
//                       color: Colors.black38,
//                     ))),
//                 validator: (val) {
//                   if (val == null || val.isEmpty) {
//                     return 'Enter your Enter';
//                   }
//
//                   return null;
//                 },
//               ),
import 'package:flutter/material.dart';
import 'dart:async';

final StreamController<ChatMessageModel> _chatMessagesStreamController =
    StreamController<ChatMessageModel>.broadcast();
final Stream<ChatMessageModel> _chatMessagesStream =
    _chatMessagesStreamController.stream;

const Color primaryColor = Color(0xff6DA7B9);
const Color secondaryColor = Color(0xffF0F0F0);

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chat Screen',
      home: ChatScreen(),
    );
  }
}

class ChatMessageModel {
  final String? message;

  const ChatMessageModel({
    this.message,
  });

  factory ChatMessageModel.turnSnapshotIntoListRecord(Map data) {
    return ChatMessageModel(
      message: data['message'],
    );
  }

  List<Object> get props => [
        message!,
      ];
}

class ChatScreen extends StatefulWidget {
  static const String id = 'chat_screen9';

  @override
  _ChatScreenState createState() => _ChatScreenState();
}

class _ChatScreenState extends State<ChatScreen> {
  final _messageTextController = TextEditingController();

  String? _userInput;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: secondaryColor,
      appBar: AppBar(
        title: Row(
          children: [
            Container(
              padding: EdgeInsets.all(8.0),
              child: Text(
                'Chat Screen',
                style: TextStyle(
                  color: Colors.white,
                ),
              ),
            )
          ],
        ),
        backgroundColor: primaryColor,
      ),
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            MessagesStream(),
            Container(
              decoration: BoxDecoration(
                border: Border(
                  top: BorderSide(
                    color: primaryColor,
                    width: 1.0,
                  ),
                ),
              ),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Expanded(
                    child: TextField(
                      controller: _messageTextController,
                      onChanged: (value) {
                        _userInput = value;
                      },
                      decoration: InputDecoration(
                        contentPadding: EdgeInsets.symmetric(
                            vertical: 10.0, horizontal: 20.0),
                        hintText: 'Type your answer here',
                        // border: InputBorder.none,
                      ),
                    ),
                  ),
                  TextButton(
                    onPressed: () {
                      _messageTextController.clear();

                      debugPrint(
                          'Adding a ChatMessageModel with the message $_userInput to the Stream');

                      ChatMessageModel chatMessageModelRecord =
                          ChatMessageModel(message: _userInput);

                      _chatMessagesStreamController.add(
                        chatMessageModelRecord,
                      );
                    },
                    child: Text(
                      'OK',
                      style: TextStyle(
                        color: primaryColor,
                        fontWeight: FontWeight.bold,
                        fontSize: 18.0,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class MessagesStream extends StatefulWidget {
  @override
  _MessagesStreamState createState() => _MessagesStreamState();
}

class _MessagesStreamState extends State<MessagesStream> {
  final List<ChatMessageModel> _allMessagesContainedInTheStream = [];

  @override
  void initState() {
    _chatMessagesStream.listen((streamedMessages) {
      // _allMessagesContainedInTheStream.clear();

      debugPrint('Value from controller: $streamedMessages');

      _allMessagesContainedInTheStream.add(streamedMessages);
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return StreamBuilder<ChatMessageModel>(
      stream: _chatMessagesStream,
      builder: (context, snapshot) {
        return Expanded(
          child: ListView.builder(
            // reverse: true,
            padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
            itemCount: _allMessagesContainedInTheStream.length,
            itemBuilder: (BuildContext context, int index) {
              if (snapshot.hasData) {
                return UserChatBubble(
                  chatMessageModelRecord:
                      _allMessagesContainedInTheStream[index],
                );
              } else {
                print(snapshot.connectionState);
                return Container();
              }
            },
          ),
        );
      },
    );
  }
}

class UserChatBubble extends StatelessWidget {
  final ChatMessageModel chatMessageModelRecord;

  const UserChatBubble({
    Key? key,
    required this.chatMessageModelRecord,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.end,
      children: [
        Padding(
          padding: EdgeInsets.symmetric(
            vertical: 5,
            horizontal: 5,
          ),
          child: Container(
            constraints: BoxConstraints(
              maxWidth: MediaQuery.of(context).size.width * 7 / 10,
            ),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(15.0),
                bottomRight: Radius.circular(15.0),
                topLeft: Radius.circular(15.0),
              ),
              color: primaryColor,
            ),
            padding: EdgeInsets.symmetric(
              vertical: 8,
              horizontal: 20,
            ),
            child: Text(
              "${chatMessageModelRecord.message}",
              style: TextStyle(
                fontSize: 17,
                // fontWeight: FontWeight.w500,
                color: Colors.white,
              ),
            ),
          ),
        ),
      ],
    );
  }
}
todayDate() {
    var now = new DateTime.now();
    var formatter = new DateFormat('dd-MM-yyyy');
    String formattedTime = DateFormat('kk:mm:a').format(now);
    String formattedDate = formatter.format(now);
    print(formattedTime);
    print(formattedDate);
  }
import 'dart:isolate';

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: BodyWidget(),
      ),
    );
  }
}

class BodyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          CircularProgressIndicator(),
          ElevatedButton(
            child: Text('start'),
            onPressed: () async {

              //ReceivePort is to listen for the isolate to finish job
              final receivePort = ReceivePort();
              // here we are passing method name and sendPort instance from ReceivePort as listener
              await Isolate.spawn(
                  computationallyExpensiveTask, receivePort.sendPort);

              //It will listen for isolate function to finish
              receivePort.listen((sum) {
                print(sum);
              });
            },
          )
        ],
      ),
    );
  }
}

// this function should be either top level(outside class) or static method
void computationallyExpensiveTask(SendPort sendPort) {
  print('heavy work started');
  var sum = 0;
  for (var i = 0; i <= 1000000000; i++) {
    sum += i;
  }
  print('heavy work finished');
  //Remember there is no return, we are sending sum to listener defined defore.
  sendPort.send(sum);
}
class _SplashScreenState extends State<SplashScreen> {
  
  @override
  initState() {
    super.initState();

    Future.delayed(const Duration(seconds: 3), () {
      Navigator.of(context).pushReplacement(
        MaterialPageRoute(
          builder: (context) => Wrapper(),
        ),
      );
    });
  }

// other methods 

}
List chunk(List list, int chunkSize) {
  List chunks = [];
  int len = list.length;
  for (var i = 0; i < len; i += chunkSize) {
    int size = i+chunkSize;
    chunks.add(list.sublist(i, size > len ? len : size));
  }
  return chunks;
}

List nums = [1,2,3,4,5];

print(chunk(nums, 2));

// [[1,2], [3,4], [5]]
Navigator.pushReplacement(context, MaterialPageRoute(builder: (BuildContext context){
  return NewPage();
}));
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (BuildContext context){
  return NewPage();
}), (r){
  return false;
});
FocusManager.instance.primaryFocus?.unfocus();
import 'package:flutter/material.dart';

void main() {
  runApp( MaterialApp(
       home: Home()
  ));
}

class Home extends  StatefulWidget {
  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {

  TextEditingController textarea = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
         appBar: AppBar(
            title: Text("Multi Line TextField"),
            backgroundColor: Colors.redAccent,
         ),
          body: Container(
             alignment: Alignment.center,
             padding: EdgeInsets.all(20),
             child: Column(
               children: [
                   TextField(
                      controller: textarea,
                      keyboardType: TextInputType.multiline,
                      maxLines: 4,
                      decoration: InputDecoration( 
                         hintText: "Enter Remarks",
                         focusedBorder: OutlineInputBorder(
                            borderSide: BorderSide(width: 1, color: Colors.redAccent)
                         )
                      ),
                       
                   ),

                   ElevatedButton(
                     onPressed: (){
                         print(textarea.text);
                     }, 
                     child: Text("Get TextField Value")
                    )
               ],
             ),
          )
      );
  }
}
class MySwitcher extends StatelessWidget {
  const MySwitcher({super.key});

  @override
  Widget build(BuildContext context) {
    final status = context.select((MyBloc bloc) => bloc.state.status);
    switch (status) {
      case MyStatus.initial:
      case MyStatus.loading:
        return const Center(child: CircularProgressIndicator());
      case MyStatus.success:
        return const MyView();
      case MyStatus.error:
        return Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Text('Something went wrong.'),
              const SizedBox(height: 16),
              ElevatedButton(
                onPressed: () {
                  context.read<MyBloc>().add(MyDataRequested());
                },
                child: const Text('Try again'),
              ),
            ],
          ),
        );
    }
  }
}
// PAGE
class MyPage extends StatelessWidget {
  const MyPage({super.key});
 
  static String path = 'my';
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // Inject Bloc(s)
      body: BlocProvider(
        create: (context) => MyBloc(
          dependency: context.read<Dependency>(),
        )..add(MyDataRequested()),
        // SWITCHER
        // MySwitcher, and all its nested child Widgets, will have access to MyBloc
        child: const MySwitcher(),
      ),
    );
  }
}
class MyBloc extends Bloc<MyEvent, MyState> {
  MyBloc({required Dependency dependency})
      : _dependency = dependency,
        super(const MyState()) {
    on<MyDataRequested>(_dataRequested);
  }

  final Dependency _dependency;

  FutureOr<void> _dataRequested(
    MyDataRequested event,
    Emitter<MyState> emit,
  ) async {
    emit(state.copyWith(status: MyStatus.loading));
    try {
      final myAsyncData = await _dependency.asyncCall();
      emit(
        state.copyWith(
          myAsyncData: myAsyncData,
          status: MyStatus.success,
        ),
      );
    } catch (error, stackTrace) {
      addError(error, stackTrace);
      emit(state.copyWith(status: MyStatus.error));
    }
  }
}
enum MyStatus { initial, loading, success, error }

class MyState extends Equatable {
  const MyState({
    this.myAsyncData,
    this.status = MyStatus.initial,
  });

  final AsyncData? myAsyncData;
  final MyStatus status;

  @override
  List<Object> get props => [myAsyncData, status];

  // Creates a new state with the changed data keeping the BlocState immutable
  MyState copyWith({
    AsyncData? myAsyncData,
    MyStatus? status,
  }) {
    return MyState(
      myAsyncData: myAsyncData ?? this.myAsyncData,
      status: status ?? this.status,
    );
  }
}
// PAGE
class MyPage extends StatelessWidget {
  const MyPage({super.key});
 
  static String path = 'my';
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // Inject Bloc(s)
      body: BlocProvider(
        create: (context) => MyBloc(dependency: context.read<Dependency>()),
        // VIEW
        // MyView, and all its nested child Widgets, will have access to MyBloc
        child: const MyView(),
      ),
    );
  }
}
File image = File("/storage/emulated/0/Android/data/my_app/files/Pictures/image_214.png");  // Replace the path string with any valid path on your device if you want to test it out. out
String fileName = file.path.split('/').last;
import 'package:flutter/material.dart';
import 'package:pie_chart/pie_chart.dart';

class HomePage extends StatelessWidget {
  Map<String, double> dataMap = {
    "Flutter": 5,
    "React": 3,
    "Xamarin": 2,
    "Ionic": 2,
  };

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Pie Chart"),
        centerTitle: true,
        backgroundColor: Colors.green[700],
        brightness: Brightness.dark,
      ),
      body: Container(
        child: Center(
          child: PieChart(
            dataMap: dataMap,
            chartRadius: MediaQuery.of(context).size.width / 1.7,
            legendOptions: LegendOptions(
              legendPosition: LegendPosition.bottom,
            ),
            chartValuesOptions: ChartValuesOptions(
              showChartValuesInPercentage: true,
            ),
          ),
        ),
      ),
    );
  }
}
import 'dart:ui' show ImageFilter;

import 'package:flutter/material.dart';

class BlurContainer extends StatelessWidget {
  final Widget child;
  final double? height;
  final double? width;
  final double elevation;
  final double blur;
  final EdgeInsetsGeometry padding;
  final Color color;
  final BorderRadius borderRadius;
  final String? image;
  final AlignmentGeometry? imageAlignment;

  const BlurContainer({
    Key? key,
    required this.child,
    this.height,
    this.width,
    this.blur = 5,
    this.elevation = 0,
    this.padding = const EdgeInsets.all(8),
    this.color = Colors.transparent,
    this.borderRadius = const BorderRadius.all(Radius.circular(20)),
    this.image,
    this.imageAlignment,
  }) : super(key: key);

  const BlurContainer.square({
    Key? key,
    required this.child,
    double? dimension,
    this.blur = 5,
    this.elevation = 0,
    this.padding = const EdgeInsets.all(8),
    this.color = Colors.transparent,
    this.borderRadius = const BorderRadius.all(Radius.circular(20)),
    this.image,
    this.imageAlignment,
  })  : width = dimension,
        height = dimension,
        super(key: key);

  const BlurContainer.expand({
    Key? key,
    required this.child,
    this.blur = 5,
    this.elevation = 0,
    this.padding = const EdgeInsets.all(8),
    this.color = Colors.transparent,
    this.borderRadius = BorderRadius.zero,
    this.image,
    this.imageAlignment,
  })  : width = double.infinity,
        height = double.infinity,
        super(key: key);

  @override
  Widget build(BuildContext context) {
    return Material(
      elevation: elevation,
      color: Colors.transparent,
      borderRadius: borderRadius,
      child: ClipRRect(
        borderRadius: borderRadius,
        child: BackdropFilter(
          filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur),
          child: Container(
            height: height,
            width: width,
            padding: padding,
            decoration: BoxDecoration(
                color: color,
                image: image != null
                    ? DecorationImage(
                        image: AssetImage(image!),
                        alignment: imageAlignment ?? Alignment.center,
                      )
                    : null),
            child: child,
          ),
        ),
      ),
    );
  }
}
import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class BlocLoggerObserver extends BlocObserver {
  @override
  void onCreate(BlocBase bloc) {
    super.onCreate(bloc);
    _log("bloc created: $bloc");
  }

  @override
  void onClose(BlocBase bloc) {
    super.onClose(bloc);
    _log("bloc closed: $bloc");
  }

  @override
  void onChange(BlocBase bloc, Change change) {
    super.onChange(bloc, change);
    _log("bloc changed: $bloc, $change");
  }

  @override
  void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
    super.onError(bloc, error, stackTrace);
    _log("bloc error: $bloc, $error, $stackTrace");
  }

  @override
  void onEvent(Bloc bloc, Object? event) {
    super.onEvent(bloc, event);
    _log("bloc event: $bloc, $event");
  }


  void _log(message) {
    if (kDebugMode) {
      print(message);
    }
  }
}
main() async {
  var process = await Process.start('cat', []);
  process.stdout
      .transform(utf8.decoder)
      .forEach(print);
  process.stdin.writeln('Hello, world!');
  process.stdin.writeln('Hello, galaxy!');
  process.stdin.writeln('Hello, universe!');
}
void main() async {
  final p = await Process.start('bash', ['-c', 'sleep 3']);
  await stdout.addStream(p.stdout);
  print('the end 😎');
}
import 'package:flutter/material.dart';

extension ImagePreloadExtention on Image {
  void preload({
    VoidCallback? onImageLoaded,
    VoidCallback? onError,
  }) {
    image
        .resolve(ImageConfiguration())
        .addListener(ImageStreamListener((ImageInfo info, bool syncCall) {
          onImageLoaded?.call();
        }, onError: (Object exception, StackTrace? stackTrace) {
          onError?.call();
        }));
  }
}

extension PreloadImageProviderExtension on ImageProvider {
  void preload({
    VoidCallback? onImageLoaded,
    VoidCallback? onError,
  }) {
    this
        .resolve(ImageConfiguration())
        .addListener(ImageStreamListener((ImageInfo info, bool syncCall) {
          onImageLoaded?.call();
        }, onError: (Object exception, StackTrace? stackTrace) {
          onError?.call();
        }));
  }
}
import 'package:async/async.dart';
import 'package:flutter/material.dart';

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  RestartableTimer timer;
  bool liked = false;

  onPressed() {
    // switch state instantly so the user doesn't have to wait,
    // (even tho the action is still not executed on the backend/database side)
    setState(() {
      liked = !liked;
    });

    if (timer?.isActive ?? false) {
      timer.reset();
    } else {
      timer = RestartableTimer(Duration(milliseconds: 3000), likeAction);
    }
  }

  likeAction() {
    // execute the action on your database and finally setState accordingly
    print('currentState: $liked' );
    // ..
    // ..
    // ..
    // setState({liked = ..});
  }

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.white,
      child: Center(
        child: IconButton(
          icon: Icon(
            liked ? Icons.favorite : Icons.favorite_border,
            size: 36,
          ),
          color: Colors.redAccent,
          onPressed: onPressed,
        ),
      ),
    );
  }
}
dart pub global activate flutterfire_cli  
export PATH="$PATH":"$HOME/.pub-cache/bin"
curl -sL https://firebase.tools | bash  
firebase login
flutterfire configure
@override
Widget build(BuildContext context) {
  MediaQueryData windowData =
      MediaQueryData.fromWindow(WidgetsBinding.instance!.window);
  windowData = windowData.copyWith(
    textScaleFactor:
        windowData.textScaleFactor > 1.4 ? 1.4 : windowData.textScaleFactor,
  );
  return MediaQuery(
    data: windowData,
    child: MaterialApp(
      useInheritedMediaQuery: true,

      //...
    ),
  );
}

final appDocDir = await getApplicationDocumentsDirectory();
final filePath = "${appDocDir.absolute}/path/to/mountains.jpg";
final file = File(filePath);

// Create the file metadata
final metadata = SettableMetadata(contentType: "image/jpeg");

// Create a reference to the Firebase Storage bucket
final storageRef = FirebaseStorage.instance.ref();

// Upload file and metadata to the path 'images/mountains.jpg'
final uploadTask = storageRef
    .child("images/path/to/mountains.jpg")
    .putFile(file, metadata);

// Listen for state changes, errors, and completion of the upload.
uploadTask.snapshotEvents.listen((TaskSnapshot taskSnapshot) {
  switch (taskSnapshot.state) {
    case TaskState.running:
      final progress =
          100.0 * (taskSnapshot.bytesTransferred / taskSnapshot.totalBytes);
      print("Upload is $progress% complete.");
      break;
    case TaskState.paused:
      print("Upload is paused.");
      break;
    case TaskState.canceled:
      print("Upload was canceled");
      break;
    case TaskState.error:
      // Handle unsuccessful uploads
      break;
    case TaskState.success:
      // Handle successful uploads on complete
      // ...
      break;
  }
});
storePassword=123456
keyPassword=123456
keyAlias=key
storeFile=D:\flutterapps\testapp\key.jks
import 'package:flutter_dotenv/flutter_dotenv.dart';

extension DotEnvX on DotEnv {
  String get privateKey => env['PRIVATE_KEY']!;

  String get contractAddress => env['CONTRACT_ADDRESS']!;

  String get rcpUrl => env['RCP_URL']!;

  String get wsUrl => env['WS_URL']!;
}
export 'dot_env_extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:hello_web3/hello/hello.dart';
import 'package:hello_web3/l10n/l10n.dart';
import 'package:smart_contract_repository/smart_contract_repository.dart';

class App extends StatelessWidget {
  const App({
    required SmartContractRepository smartContractRepository,
    super.key,
  }) : _smartContractRepository = smartContractRepository;

  final SmartContractRepository _smartContractRepository;

  @override
  Widget build(BuildContext context) {
    return MultiRepositoryProvider(
      providers: [RepositoryProvider.value(value: _smartContractRepository)],
      child: const AppView(),
    );
  }
}

class AppView extends StatelessWidget {
  const AppView({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        appBarTheme: const AppBarTheme(color: Color(0xFF13B9FF)),
        colorScheme: ColorScheme.fromSwatch(
          accentColor: const Color(0xFF13B9FF),
        ),
      ),
      localizationsDelegates: const [
        AppLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
      ],
      supportedLocales: AppLocalizations.supportedLocales,
      home: const HelloPage(),
    );
  }
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hello_web3/hello/hello.dart';
import 'package:hello_web3/l10n/l10n.dart';

class HelloDataContent extends StatelessWidget {
  const HelloDataContent({super.key});

  @override
  Widget build(BuildContext context) {
    final state = context.watch<HelloBloc>().state;
    final l10n = context.l10n;

    return Column(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        const SizedBox(height: 16),
        Text(
          l10n.helloWord,
          textAlign: TextAlign.center,
          style: Theme.of(context).textTheme.headline3,
        ),
        const SizedBox(height: 16),
        Text(
          '${state.name}',
          textAlign: TextAlign.center,
          style: Theme.of(context)
              .textTheme
              .headline5
              ?.copyWith(fontWeight: FontWeight.w600),
        ),
        const SizedBox(height: 16),
        if (state.isLoading)
          const Center(child: CircularProgressIndicator())
        else
          const SetNameButton(),
        const SizedBox(height: 16),
        Expanded(
          child: ListView.builder(
            itemBuilder: (context, index) {
              final hashIndex = (state.txHashes.length - 1) - index;
              return ListTile(
                title: Text('${l10n.transactionWord} ${hashIndex + 1}'),
                subtitle: Text(state.txHashes[hashIndex]),
              );
            },
            itemCount: state.txHashes.length,
          ),
        ),
      ],
    );
  }
}

class SetNameButton extends StatelessWidget {
  const SetNameButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 64),
      child: ElevatedButton(
        onPressed: () {
          context.read<HelloBloc>().add(HelloRandomNameSet());
        },
        child: Text(context.l10n.setNameLabel),
      ),
    );
  }
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hello_web3/hello/hello.dart';
import 'package:hello_web3/l10n/l10n.dart';

class HelloErrorContent extends StatelessWidget {
  const HelloErrorContent({super.key});

  @override
  Widget build(BuildContext context) {
    final state = context.watch<HelloBloc>().state;

    return Center(
      child: state.isLoading
          ? const CircularProgressIndicator()
          : const TryAgainButton(),
    );
  }
}

class TryAgainButton extends StatelessWidget {
  const TryAgainButton({super.key});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 64),
      child: ElevatedButton(
        onPressed: () {
          context.read<HelloBloc>().add(HelloNameRequested());
        },
        child: Text(context.l10n.tryAgainLabel),
      ),
    );
  }
}
export 'hello_data_content.dart';
export 'hello_error_content.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hello_web3/hello/hello.dart';
import 'package:hello_web3/l10n/l10n.dart';

class HelloView extends StatelessWidget {
  const HelloView({super.key});

  @override
  Widget build(BuildContext context) {
    final l10n = context.l10n;
    return Scaffold(
      appBar: AppBar(title: Text(l10n.appTitle)),
      body: BlocConsumer<HelloBloc, HelloState>(
        listenWhen: (prev, curr) => prev.status != curr.status && curr.hasError,
        listener: (context, state) {
          ScaffoldMessenger.of(context).clearSnackBars();
          ScaffoldMessenger.of(context).showSnackBar(
            SnackBar(content: Text(l10n.errorMessage)),
          );
        },
        builder: (context, state) {
          if (state.hasData) {
            return const HelloDataContent();
          } else if (state.hasError) {
            return const HelloErrorContent();
          }
          return const Center(
            child: CircularProgressIndicator(),
          );
        },
      ),
    );
  }
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hello_web3/hello/hello.dart';
import 'package:smart_contract_repository/smart_contract_repository.dart';
import 'package:username_generator/username_generator.dart';

class HelloPage extends StatelessWidget {
  const HelloPage({super.key});

  @override
  Widget build(BuildContext context) {
    return BlocProvider(
      create: (context) => HelloBloc(
        smartContractRepository: context.read<SmartContractRepository>(),
        usernameGenerator: UsernameGenerator(),
      )..add(HelloNameRequested()),
      child: const HelloView(),
    );
  }
}
export 'hello_page.dart';
export 'hello_view.dart';
export 'bloc/hello_bloc.dart';
export 'view/view.dart';
export 'widgets/widgets.dart';
import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
import 'package:smart_contract_repository/smart_contract_repository.dart';
import 'package:username_generator/username_generator.dart';

part 'hello_event.dart';
part 'hello_state.dart';

class HelloBloc extends Bloc<HelloEvent, HelloState> {
  HelloBloc({
    required SmartContractRepository smartContractRepository,
    required UsernameGenerator usernameGenerator,
  })  : _smartContractRepository = smartContractRepository,
        _usernameGenerator = usernameGenerator,
        super(const HelloState()) {
    on<HelloNameRequested>(_nameRequested);
    on<HelloRandomNameSet>(_randomNameSet);
  }

  final SmartContractRepository _smartContractRepository;
  final UsernameGenerator _usernameGenerator;

  FutureOr<void> _nameRequested(
    HelloNameRequested event,
    Emitter<HelloState> emit,
  ) async {
    emit(state.copyWith(status: HelloAsyncStatus.loading));

    try {
      final name = await _smartContractRepository.getName();
      emit(state.copyWith(status: HelloAsyncStatus.success, name: name));
    } catch (e, s) {
      addError(e, s);
      emit(state.copyWith(status: HelloAsyncStatus.error));
    }
  }

  FutureOr<void> _randomNameSet(
    HelloRandomNameSet event,
    Emitter<HelloState> emit,
  ) async {
    emit(state.copyWith(status: HelloAsyncStatus.loading));
    try {
      final name = _usernameGenerator.generateRandom();
      final txHash = await _smartContractRepository.setName(name: name);
      emit(
        state.copyWith(
          name: name,
          txHashes: [...state.txHashes, txHash],
          status: HelloAsyncStatus.success,
        ),
      );
    } catch (e, s) {
      addError(e, s);
      emit(state.copyWith(status: HelloAsyncStatus.error));
    }
  }
}
part of 'hello_bloc.dart';

enum HelloAsyncStatus { initial, loading, success, error }

@immutable
class HelloState extends Equatable {
  const HelloState({
    this.status = HelloAsyncStatus.initial,
    this.name,
    this.txHashes = const [],
  });

  final HelloAsyncStatus status;
  final String? name;
  final List<String> txHashes;

  bool get hasData =>
      status == HelloAsyncStatus.success || name != null || txHashes.isNotEmpty;

  bool get hasError => status == HelloAsyncStatus.error;

  bool get isLoading => status == HelloAsyncStatus.loading;

  @override
  List<Object?> get props => [status, name, txHashes];

  HelloState copyWith({
    HelloAsyncStatus? status,
    String? name,
    List<String>? txHashes,
  }) {
    return HelloState(
      status: status ?? this.status,
      name: name ?? this.name,
      txHashes: txHashes ?? this.txHashes,
    );
  }
}
part of 'hello_bloc.dart';

@immutable
abstract class HelloEvent extends Equatable {}

class HelloNameRequested extends HelloEvent {
  HelloNameRequested();
  @override
  List<Object?> get props => [];
}

class HelloRandomNameSet extends HelloEvent {
  HelloRandomNameSet();

  @override
  List<Object?> get props => [];
}
import 'package:smart_contract_client/smart_contract_client.dart';
import 'package:smart_contract_repository/smart_contract_repository.dart';

class SmartContractRepository {
  const SmartContractRepository({required SmartContractClient client})
      : _client = client;

  final SmartContractClient _client;

  Future<String> getName() async {
    try {
      return _client.getName();
    } catch (e) {
      throw SmartContractRepositoryException(e);
    }
  }

  Future<String> setName({required String name}) async {
    try {
      return _client.setName(name: name);
    } catch (e) {
      throw SmartContractRepositoryException(e);
    }
  }
}
library smart_contract_repository;

export 'src/exceptions.dart';
export 'src/smart_contract_repository.dart';
import 'package:smart_contract_repository/smart_contract_repository.dart';

class SmartContractRepositoryException implements Exception {
  const SmartContractRepositoryException(this.originalException);

  final Object originalException;

  @override
  String toString() =>
      'SmartContractRepositoryException -> ${originalException.toString()}';
}
import 'package:smart_contract_client/smart_contract_client.dart';
import 'package:web3dart/web3dart.dart';

class SmartContractClient {
  SmartContractClient({
    required Web3Client web3client,
    required String privateKey,
    required String abi,
    required String contractAddress,
  })  : _web3Client = web3client,
        _privateKey = privateKey,
        _abi = abi,
        _contractAddress = contractAddress;

  SmartContract get _contract => SmartContract.fromData(
        abiInfo: _abi,
        privateKey: _privateKey,
        contractAddress: _contractAddress,
      );

  final Web3Client _web3Client;
  final String _privateKey;
  final String _abi;
  final String _contractAddress;

  Future<String> getName() async {
    try {
      final name = await _web3Client.call(
        contract: _contract,
        function: _contract.getName(),
        params: <dynamic>[],
      );

      return name[0] as String;
    } catch (e) {
      throw SmartContractClientException(e);
    }
  }

  Future<String> setName({required String name}) async {
    try {
      final transactionHash = await _web3Client.sendTransaction(
        _contract.credentials,
        Transaction.callContract(
          contract: _contract,
          function: _contract.setName(),
          parameters: <dynamic>[name],
        ),
      );
      return transactionHash;
    } catch (e) {
      throw SmartContractClientException(e);
    }
  }
}
import 'dart:convert';

import 'package:web3dart/web3dart.dart';
import 'package:smart_contract_client/smart_contract_client.dart';

class SmartContract extends DeployedContract {
  SmartContract._(super.abi, super.address, this.credentials);

  factory SmartContract.fromData({
    required String abiInfo,
    required String privateKey,
    required String contractAddress,
  }) {
    try {
      final abiDecoded = jsonDecode(abiInfo) as Map<String, dynamic>;
      final abi = jsonEncode(abiDecoded['abi']);
      final address = EthereumAddress.fromHex(contractAddress);
      final credentials = EthPrivateKey.fromHex(privateKey);

      return SmartContract._(
        ContractAbi.fromJson(abi, 'HelloWeb3'),
        address,
        credentials,
      );
    } catch (e) {
      throw SmartContractException(e);
    }
  }

  final Credentials credentials;

  ContractFunction getName() => function('getName');

  ContractFunction setName() => function('setName');
}
import 'package:smart_contract_client/smart_contract_client.dart';

class SmartContractClientException implements Exception {
  const SmartContractClientException(this.originalException);

  final Object originalException;

  @override
  String toString() =>
      'SmartContractClientException -> ${originalException.toString()}';
}

class SmartContractException implements Exception {
  const SmartContractException(this.originalException);

  final Object originalException;

  @override
  String toString() =>
      'SmartContractException: Failed to create SmartContract -> '
      '${originalException.toString()}';
}
library smart_contract_client;

export 'src/exceptions.dart';
export 'src/smart_contract.dart';
export 'src/smart_contract_client.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:hello_web3/app/app.dart';
import 'package:hello_web3/extensions/extensions.dart';
import 'package:http/http.dart' as http;
import 'package:smart_contract_client/smart_contract_client.dart';
import 'package:smart_contract_repository/smart_contract_repository.dart';
import 'package:web3dart/web3dart.dart';
import 'package:web_socket_channel/io.dart';

Future<Widget> mainCommon() async {
  WidgetsFlutterBinding.ensureInitialized();

  final abi = await rootBundle.loadString('web3/artifacts/HelloWeb3.json');
  await dotenv.load();

  final web3Client = Web3Client(
    dotenv.rcpUrl,
    http.Client(),
    socketConnector: () =>
        IOWebSocketChannel.connect(dotenv.wsUrl).cast<String>(),
  );

  final smartContractClient = SmartContractClient(
    abi: abi,
    privateKey: dotenv.privateKey,
    contractAddress: dotenv.contractAddress,
    web3client: web3Client,
  );

  final smartContractRepository =
      SmartContractRepository(client: smartContractClient);

  return App(smartContractRepository: smartContractRepository);
}
var collection = FirebaseFirestore.instance.collection('collection');
collection
    .doc('doc_id')
    .set({'payment_customer_id': customerResponse!.data.customerId, }, SetOptions(merge: true)); // <-- Set merge to true.
var collection = FirebaseFirestore.instance.collection('collection');
collection 
    .doc('doc_id')
    .update({'key.foo.bar' : 'nested_value'}) // <-- Nested value
    .then((_) => print('Success'))
    .catchError((error) => print('Failed: $error'));
postData() async {
    try {
      var response = await http.post(
          Uri.parse("https://zen-api-1010.azure-api.net/notes/v1/create"),
          headers: {
            "Content-type": "application/json",
            "Accept": "application/json",
            "Ocp-Apim-Subscription-Key": "008c47b597e54aedadbd5e4d270b35ed",
            "Ocp-Apim-Trace": "true"
          },
          body: jsonEncode({
            "noteType": 0.toString(),
            "description": "KUSHAN  1".toString(),
            "authorReaction": 0.toString(),
            "privacy": 0.toString(),
          }));
      print(response.statusCode);
    } catch (e) {
      print(e);
    }
  }
Future listDir(String folderPath) async {
  var directory = new Directory(folderPath);
  print(directory);

  var exists = await directory.exists();
  if (exists) {
    print("exits");

    directory
      .list(recursive: true, followLinks: false)
      .listen((FileSystemEntity entity) {
        print(entity.path);
      });
  }
}
       Image.network(
                  widget.networkUrl,
                  fit: BoxFit.fill,
                  loadingBuilder: (BuildContext context, Widget child,
                      ImageChunkEvent? loadingProgress) {
                    if (loadingProgress == null) return child;
                    return Center(
                      child: CircularProgressIndicator(
                        value: loadingProgress.expectedTotalBytes != null
                            ? loadingProgress.cumulativeBytesLoaded /
                                loadingProgress.expectedTotalBytes!
                            : null,
                      ),
                    );
                  },
                ),
BarChart(
    ...
    domainAxis: charts.OrdinalAxisSpec(
              renderSpec: charts.SmallTickRendererSpec(labelRotation: 60),
       ),
 ),
class HomeView extends GetView<HomeController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ListView Filter'),
        centerTitle: true,
      ),
      body: Padding(
        padding: const EdgeInsets.all(10),
        child: Column(
          children: [
            const SizedBox(
              height: 20,
            ),
            TextField(
             onChanged: (value) => controller.filterPlayer(value), //slanje value iz filtera 
              decoration: const InputDecoration(
                labelText: 'Search',
                suffixIcon: Icon(Icons.search),
              ),
            ),
            const SizedBox(
              height: 20,
            ),
            Expanded(
              child: Obx(
                () => ListView.builder(
                  itemCount: controller.foundPlayers.value.length, // da nam prikaze duzinu
                  itemBuilder: (context, index) => ListTile( 
                    title: Text(
                      controller.foundPlayers.value[index]['name'], // sta vadimo iz liste
                      style:
                          TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
                    ),
                    subtitle:
                      Text(controller.foundPlayers.value[index]['country']),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
final List<Map<String, dynamic>> allPlayers = [
    {"name": "Rohit Sharma", "country": "India"},
    {"name": "Virat Kohli ", "country": "India"},
    {"name": "Glenn Maxwell", "country": "Australia"},
    {"name": "Aaron Finch", "country": "Australia"},
    {"name": "Martin Guptill", "country": "New Zealand"},
    {"name": "Trent Boult", "country": "New Zealand"},
    {"name": "David Miller", "country": "South Africa"},
    {"name": "Kagiso Rabada", "country": "South Africa"},
    {"name": "Chris Gayle", "country": "West Indies"},
    {"name": "Jason Holder", "country": "West Indies"},
  ];
  Rx<List<Map<String, dynamic>>> foundPlayers =
      Rx<List<Map<String, dynamic>>>([]);

  @override
  void onInit() {
    super.onInit();
    foundPlayers.value = allPlayers;
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {}
  void filterPlayer(String playerName) {
    List<Map<String, dynamic>> results = [];
    if (playerName.isEmpty) {
      results = allPlayers;
    } else {
      results = allPlayers
          .where((element) => element["name"]
              .toString()
              .toLowerCase()
              .contains(playerName.toLowerCase()))
          .toList();
    }
    foundPlayers.value = results;
  }
class UserProvider extends GetConnect {
  Future<List<dynamic>> getUser() async {
    final response = await get("https://randomuser.me/api/?results=10");
    if (response.status.hasError) {
      return Future.error(response.statusText);
    } else {
      return response.body['results'];
    }
  }
}
class HomeController extends GetxController with StateMixin<List<dynamic>> {


  @override
  void onInit() {
    super.onInit();
    UserProvider().getUser().then((resp) {
      change(resp, status: RxStatus.success());
    }, onError: (err) {

      change(
        null,
        status: RxStatus.error(err.toString()),
      );
    });

  }

}
ontroller.obx(
        (data) => ListView.builder(
            padding: EdgeInsets.all(8),
            itemCount: data.length,
            itemBuilder: (BuildContext context, int index) {
              return Card(
                child: Column(
                  children: <Widget>[
                    ListTile(
                      leading: CircleAvatar(
                        radius: 30,
                        backgroundImage:
                            NetworkImage(data[index]['picture']['large']),
                      ),
                      title: Text(
                        data[index]['name']['title'] +
                            " " +
                            data[index]['name']['first'] +
                            " " +
                            data[index]['name']['last'],
                      ),
                      subtitle: Text(
                        data[index]['email'],
                        style: TextStyle(fontSize: 12),
                      ),
                      trailing: Text(
                        "Age : " + data[index]['dob']['age'].toString(),
                      ),
                    ),
                  ],
                ),
              );
            }),
        onError: (error) => Center(
          child: Text(error),
        ),
      ),
    );
var kruske = 0.obs;
  var jabuke = 0.obs;
  int get sum => kruske.value + jabuke.value;

  increment() {
    kruske.value++;
  }

  decrement() {
    if (kruske.value > 0) {
      kruske.value--;
    } else {
      (Get.snackbar('DJESI', 'SNEKCINO')); // stopiramo da ne moze ispod 0 ne moze se update i prikazivati i snackbar
    }
  }

  increment2() {
    jabuke.value++;
  }

  decrement2() {
    if (jabuke.value > 0) {
      jabuke.value--;
    }
  }
children: [
            Row(
              children: [
                ElevatedButton(
                    onPressed: () => controller.decrement(), child: Text('-')),
                Obx(
                  () => Text(
                    'KRUSKE ${controller.kruske.toString()}', // prikazujemo iz controller-a kruske i pretvaramo u string jer je Text widget
                    style: TextStyle(fontSize: 30, color: Colors.black),
                  ),
                ), // obavijamo widzet u obx da bi bio reaktivan 
                ElevatedButton(
                    onPressed: () => controller.increment(), child: Text('+')), // dugme koje poziva funkciju increment iz controller-a 
              ],
            ),
            Row(
              children: [
                ElevatedButton(
                    onPressed: () => controller.decrement2(), child: Text('-')),
                Obx(() => Text(
                      'JABUKE ${controller.jabuke.toString()}',
                      style: TextStyle(fontSize: 30, color: Colors.black),
                    )),
                ElevatedButton(
                    onPressed: () => controller.increment2(), child: Text('+')),
              ],
            ),
            Obx(() => Text(
                  '${controller.sum.toString()}', // prikazujemo sumu iz kontrolera
                  style: TextStyle(fontSize: 30, color: Colors.black),
                )),
class WelcomeController extends GetxController {
  HomeController homeController = Get.find<HomeController>(); 
  late User user; // Tip User-a 

  @override
  void onInit() {
    user = Get.arguments; // u user-a smjestamo argument's koje smo dobili preko rutiranja u prethodnom kontroleru 
    super.onInit(); 
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {}

  void logout() async { // funkcija za logout koju pozivamo na view na dugme, cistimo kontroller potpuno od sign in-a i firebase 
    await homeController.googleSign.disconnect();
    await homeController.firebaseAuth.signOut();
  }
}
class LoginController extends GetxController {
  HomeController homeController = Get.find<HomeController>(); //nalazimo HomeController

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {} 
// login funkcija koja handluje sign in preko google-a i nju pozivamo na klik registracije iz view-a
  void login() async { 
    CustomFullScreenDialog.showDialog();
    GoogleSignInAccount? googleSignInAccount =
        await homeController.googleSign.signIn();
    if (googleSignInAccount == null) {
      CustomFullScreenDialog.cancelDialog();
    } else {
      GoogleSignInAuthentication googleSignInAuthentication =
          await googleSignInAccount.authentication;

      OAuthCredential oAuthCredential = GoogleAuthProvider.credential(
          accessToken: googleSignInAuthentication.accessToken,
          idToken: googleSignInAuthentication.idToken);

      await homeController.firebaseAuth.signInWithCredential(oAuthCredential);
      CustomFullScreenDialog.cancelDialog();
    }
  }
}
class HomeController extends GetxController {
  late GoogleSignIn googleSign; // tip GoogleSignIn koji nam treba 
  var isSignIn = false.obs; // stavljamo da je sign in po default-u false i obs
  FirebaseAuth firebaseAuth = FirebaseAuth.instance; // kreiramo instancu od firebase-a

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() async {
    googleSign = GoogleSignIn(); // smjestamo u varijablu googlesignin funkciju koja je od googl-a funkcija
    
    // prvi agument funkcije ever je ujedno i argument funkcije dolje 
    ever(isSignIn, handleAuthStateChange); //svaki put kad se sign in promijeni trigeruje se prikazana funkcija 
    
    
    firebaseAuth.authStateChanges().listen((event) {
      isSignIn.value = event != null; // slusa sami event i smjesta u signInValue event ako je razlicit od null 
    });
    super.onReady();
  }

  @override
  void onClose() {}

// funckija alp je loggenIn makni sve rute i posalji usera na Welcome i salje argument 
  void handleAuthStateChange(isLoggedIn) {
    if (isLoggedIn) {
      Get.offAllNamed(Routes.WELCOME, arguments: firebaseAuth.currentUser);
    } else {
      Get.offAllNamed(Routes.LOGIN); // ako je login false saljemo na login stranicu 
    }
  }
}
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  //.then(
  //   (value) {
  //     Get.put(HomeController());
  //   },
  // ); get.put rucno radimo kad u samom kontroleru imamo lazy.put zato sto lazy.put-u treba neki triger da bi se pokrenulo.
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      initialBinding: HomeBinding(), // ako ovdje stavimo inicijalizaciju homebinding-a onda ce se inicijalizovati u toku same aplikacije, tacnije nakon rendera aplikacije
      debugShowCheckedModeBanner: false,
      title: "Application",
      initialRoute: AppPages.INITIAL,
      getPages: AppPages.routes,
    );
  }
}
class Loading extends StatelessWidget {
  final Color color;

  Loading({Key? key, required this.color}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return CircularProgressIndicator(
      valueColor: AlwaysStoppedAnimation<Color>(color),
    );
  }
}

// pozivamo iz ovog dijela 


class HomeView extends GetView<HomeController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(body: Center(child:
           Loading(color: Colors.red)));
  }
}

flutter run -d chrome --web-renderer=html
flutter build web --web-renderer=html
import 'package:flutter/material.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';

class DBProvider {
  DBProvider._();

  static final DBProvider db = DBProvider._();
  static Database _database;

  Future<Database> get database async {
    if (_database != null) return _database;

    // if _database is null we instantiate it
    _database = await initDB();
    return _database;
  }

  static const tableProject = """
  CREATE TABLE IF NOT EXISTS Project (
        id TEXT PRIMARY KEY,
        managerId TEXT,
        consultantID TEXT
        name TEXT,
        description TEXT,
        created TEXT,
        deadline TEXT
      );""";
  static const tableAudit = """
  CREATE TABLE IF NOT EXISTS Audit (
        id TEXT PRIMARY key,
        projectId TEXT,
        timeTrackId TEXT,
        jsonChanges TEXT,
        date TEXT,
        employeeId TEXT
      );""";
  static const tableEmployee = """
  CREATE TABLE IF NOT EXISTS Employee (
        id TEXT PRIMARY key,
        fullName TEXT,
        managementLogonAccess INTEGER
      );""";
  static const tableJobPosition = """
  CREATE TABLE IF NOT EXISTS JobPosition (
        id TEXT PRIMARY KEY,
        name TEXT
      );""";
  static const tableWorkType = """
  CREATE TABLE IF NOT EXISTS WorkType (
        id TEXT PRIMARY key,
        name TEXT
      );""";
  static const tableAssignedJobPosition = """
  CREATE TABLE IF NOT EXISTS AssignedJobPosition (
        employeeId TEXT,
        positionId TEXT
      );""";
  static const tableTimeTrack = """
  CREATE TABLE IF NOT EXISTS TimeTrack (
        id TEXT PRIMARY key,
        timeSpan INTEGER,
        employeeId TEXT,
        projectId TEXT,
        workType TEXT,
        note TEXT,
        date TEXT
      );""";
  static const tableAllowedWorkType = """
  CREATE TABLE IF NOT EXISTS AllowedWorkType (
        projectId TEXT,
        workTypeId TEXT
      );""";

  Future<Database> initDB() async {
    print("initDB executed");
    //Directory documentsDirectory = await getApplicationDocumentsDirectory();
    String path = join(await getDatabasesPath(), "core1.db");
    await deleteDatabase(path);
    return await openDatabase(path, version: 2,
        onCreate: (Database db, int version) async {
          await db.execute(tableEmployee);
          await db.execute(tableAudit);
          await db.execute(tableProject);
          await db.execute(tableJobPosition);
          await db.execute(tableWorkType);
          await db.execute(tableAssignedJobPosition);
          await db.execute(tableTimeTrack);
          await db.execute(tableAllowedWorkType);
      /*await db.execute(tableEmployee +
          tableAudit +
          tableProject +
          tableJobPosition +
          tableWorkType +
          tableAssignedJobPosition +
          tableTimeTrack +
          tableAllowedWorkType);*/
    });
  }

  ///get all Projects
  Future/*<List<Project>>*/ getAllProjects() async {
    final db = await database;
    return await db.query("Project");
    /*var res =
    return res.isNotEmpty ? res.map((c) => Project.fromMap(c, false)).toList() : [];*/
  }
}

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() async {
    var res = await DBProvider.db.getAllProjects();
    print(res);
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
class MyWidget extends StatelessWidget {
  @override
  Widget build(context) {
    return FutureBuilder<String>(
      future: callAsyncFetch(),
      builder: (context, AsyncSnapshot<String> snapshot) {
        if (snapshot.hasData) {
          return Text(snapshot.data);
        } else {
          return CircularProgressIndicator();
        }
      }
    );
  }
}
bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          items: [
            BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Home',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.business),
            label: 'Business',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.school),
            label: 'School',
          ),
          ],
        ),
// Copyright 2018 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 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(MaterialApp(home: WebViewExample()));

const String kNavigationExamplePage = '''
<!DOCTYPE html><html>
<head><title>Navigation Delegate Example</title></head>
<body>
<p>
The navigation delegate is set to block navigation to the youtube website.
</p>
<ul>
<ul><a href="https://www.youtube.com/">https://www.youtube.com/</a></ul>
<ul><a href="https://www.google.com/">https://www.google.com/</a></ul>
<ul><a href="https://www.google.com/">https://nodejs.org/en</a></ul>
</ul>
</body>
</html>
''';

class WebViewExample extends StatefulWidget {
  @override
  _WebViewExampleState createState() => _WebViewExampleState();
}

WebViewController controllerGlobal;

Future<bool> _exitApp(BuildContext context) async {
  if (await controllerGlobal.canGoBack()) {
    print("onwill goback");
    controllerGlobal.goBack();
  } else {
    Scaffold.of(context).showSnackBar(
      const SnackBar(content: Text("No back history item")),
    );
    return Future.value(false);
  }
}

class _WebViewExampleState extends State<WebViewExample> {
  final Completer<WebViewController> _controller =
  Completer<WebViewController>();

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () => _exitApp(context),
      child: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter WebView example'),
          // This drop down menu demonstrates that Flutter widgets can be shown over the web view.
          actions: <Widget>[
            NavigationControls(_controller.future),
            SampleMenu(_controller.future),
          ],
        ),
        // We're using a Builder here so we have a context that is below the Scaffold
        // to allow calling Scaffold.of(context) so we can show a snackbar.
        body: Builder(builder: (BuildContext context) {
          return WebView(
            initialUrl: 'https://flutter.dev',
            javascriptMode: JavascriptMode.unrestricted,
            onWebViewCreated: (WebViewController webViewController) {
              _controller.complete(webViewController);
            },
            // TODO(iskakaushik): Remove this when collection literals makes it to stable.
            // ignore: prefer_collection_literals
            javascriptChannels: <JavascriptChannel>[
              _toasterJavascriptChannel(context),
            ].toSet(),
            navigationDelegate: (NavigationRequest request) {
              if (request.url.startsWith('https://www.youtube.com/')) {
                print('blocking navigation to $request}');
                return NavigationDecision.prevent;
              }
              if (request.url.startsWith('https://flutter.dev/docs')) {
                print('blocking navigation to $request}');
                return NavigationDecision.prevent;
              }
              print('allowing navigation to $request');
              return NavigationDecision.navigate;
            },
            onPageFinished: (String url) {
              print('Page finished loading: $url');
            },
          );
        }),
        floatingActionButton: favoriteButton(),
      ),
    );
  }

  JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
    return JavascriptChannel(
        name: 'Toaster',
        onMessageReceived: (JavascriptMessage message) {
          Scaffold.of(context).showSnackBar(
            SnackBar(content: Text(message.message)),
          );
        });
  }

  Widget favoriteButton() {
    return FutureBuilder<WebViewController>(
        future: _controller.future,
        builder: (BuildContext context,
            AsyncSnapshot<WebViewController> controller) {
          if (controller.hasData) {
            return FloatingActionButton(
              onPressed: () async {
                final String url = await controller.data.currentUrl();
                Scaffold.of(context).showSnackBar(
                  SnackBar(content: Text('Favorited $url')),
                );
              },
              child: const Icon(Icons.favorite),
            );
          }
          return Container();
        });
  }
}

enum MenuOptions {
  showUserAgent,
  listCookies,
  clearCookies,
  addToCache,
  listCache,
  clearCache,
  navigationDelegate,
}

class SampleMenu extends StatelessWidget {
  SampleMenu(this.controller);

  final Future<WebViewController> controller;
  final CookieManager cookieManager = CookieManager();

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<WebViewController>(
      future: controller,
      builder:
          (BuildContext context, AsyncSnapshot<WebViewController> controller) {
        return PopupMenuButton<MenuOptions>(
          onSelected: (MenuOptions value) {
            switch (value) {
              case MenuOptions.showUserAgent:
                _onShowUserAgent(controller.data, context);
                break;
              case MenuOptions.listCookies:
                _onListCookies(controller.data, context);
                break;
              case MenuOptions.clearCookies:
                _onClearCookies(context);
                break;
              case MenuOptions.addToCache:
                _onAddToCache(controller.data, context);
                break;
              case MenuOptions.listCache:
                _onListCache(controller.data, context);
                break;
              case MenuOptions.clearCache:
                _onClearCache(controller.data, context);
                break;
              case MenuOptions.navigationDelegate:
                _onNavigationDelegateExample(controller.data, context);
                break;
            }
          },
          itemBuilder: (BuildContext context) => <PopupMenuItem<MenuOptions>>[
            PopupMenuItem<MenuOptions>(
              value: MenuOptions.showUserAgent,
              child: const Text('Show user agent'),
              enabled: controller.hasData,
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.listCookies,
              child: Text('List cookies'),
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.clearCookies,
              child: Text('Clear cookies'),
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.addToCache,
              child: Text('Add to cache'),
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.listCache,
              child: Text('List cache'),
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.clearCache,
              child: Text('Clear cache'),
            ),
            const PopupMenuItem<MenuOptions>(
              value: MenuOptions.navigationDelegate,
              child: Text('Navigation Delegate example'),
            ),
          ],
        );
      },
    );
  }

  void _onShowUserAgent(
      WebViewController controller, BuildContext context) async {
    // Send a message with the user agent string to the Toaster JavaScript channel we registered
    // with the WebView.
    controller.evaluateJavascript(
        'Toaster.postMessage("User Agent: " + navigator.userAgent);');
  }

  void _onListCookies(
      WebViewController controller, BuildContext context) async {
    final String cookies =
    await controller.evaluateJavascript('document.cookie');
    Scaffold.of(context).showSnackBar(SnackBar(
      content: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          const Text('Cookies:'),
          _getCookieList(cookies),
        ],
      ),
    ));
  }

  void _onAddToCache(WebViewController controller, BuildContext context) async {
    await controller.evaluateJavascript(
        'caches.open("test_caches_entry"); localStorage["test_localStorage"] = "dummy_entry";');
    Scaffold.of(context).showSnackBar(const SnackBar(
      content: Text('Added a test entry to cache.'),
    ));
  }

  void _onListCache(WebViewController controller, BuildContext context) async {
    await controller.evaluateJavascript('caches.keys()'
        '.then((cacheKeys) => JSON.stringify({"cacheKeys" : cacheKeys, "localStorage" : localStorage}))'
        '.then((caches) => Toaster.postMessage(caches))');
  }

  void _onClearCache(WebViewController controller, BuildContext context) async {
    await controller.clearCache();
    Scaffold.of(context).showSnackBar(const SnackBar(
      content: Text("Cache cleared."),
    ));
  }

  void _onClearCookies(BuildContext context) async {
    final bool hadCookies = await cookieManager.clearCookies();
    String message = 'There were cookies. Now, they are gone!';
    if (!hadCookies) {
      message = 'There are no cookies.';
    }
    Scaffold.of(context).showSnackBar(SnackBar(
      content: Text(message),
    ));
  }

  void _onNavigationDelegateExample(
      WebViewController controller, BuildContext context) async {
    final String contentBase64 =
    base64Encode(const Utf8Encoder().convert(kNavigationExamplePage));
    controller.loadUrl('data:text/html;base64,$contentBase64');
  }

  Widget _getCookieList(String cookies) {
    if (cookies == null || cookies == '""') {
      return Container();
    }
    final List<String> cookieList = cookies.split(';');
    final Iterable<Text> cookieWidgets =
    cookieList.map((String cookie) => Text(cookie));
    return Column(
      mainAxisAlignment: MainAxisAlignment.end,
      mainAxisSize: MainAxisSize.min,
      children: cookieWidgets.toList(),
    );
  }
}



class NavigationControls extends StatelessWidget {
  const NavigationControls(this._webViewControllerFuture)
      : assert(_webViewControllerFuture != null);

  final Future<WebViewController> _webViewControllerFuture;

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<WebViewController>(
      future: _webViewControllerFuture,
      builder:
          (BuildContext context, AsyncSnapshot<WebViewController> snapshot) {
        final bool webViewReady =
            snapshot.connectionState == ConnectionState.done;
        final WebViewController controller = snapshot.data;
        controllerGlobal = controller;

        return Row(
          children: <Widget>[
            IconButton(
              icon: const Icon(Icons.arrow_back_ios),
              onPressed: !webViewReady
                  ? null
                  : () async {
                if (await controller.canGoBack()) {
                  controller.goBack();
                } else {
                  Scaffold.of(context).showSnackBar(
                    const SnackBar(content: Text("No back history item")),
                  );
                  return;
                }
              },
            ),
            IconButton(
              icon: const Icon(Icons.arrow_forward_ios),
              onPressed: !webViewReady
                  ? null
                  : () async {
                if (await controller.canGoForward()) {
                  controller.goForward();
                } else {
                  Scaffold.of(context).showSnackBar(
                    const SnackBar(
                        content: Text("No forward history item")),
                  );
                  return;
                }
              },
            ),
            IconButton(
              icon: const Icon(Icons.replay),
              onPressed: !webViewReady
                  ? null
                  : () {
                controller.reload();
              },
            ),
          ],
        );
      },
    );
  }
}
import 'package:flutter/material.dart';

class FormValidator {
  static String? empty(
    String? value,
    String errorMessage,
  ) {
    if (value == null || value.length <= 3) {
      return 'Required';
    }
    return null;
  }

  static String? validateEmail(value) {
    bool emailValid = RegExp(
            r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
        .hasMatch(value ?? '');
    if (value == null || value.isEmpty || !emailValid) {
      return 'Please enter email';
    }
    return null;
  }

  static String? password(String? value) {
    if (empty(value, 'Required') != null) {
      return empty(value, 'Required');
    }

    RegExp regEx = RegExp(r"(?=.*[A-Z])\w+");

    if (value!.length < 8 || !regEx.hasMatch(value)) {
      return 'Please enter password';
    }

    return null;
  }

  static String? passwordConfirm(value, TextEditingController controller) {
    if (value == null || value.isEmpty) {
      return 'Required';
    }

    if (value.toString() != controller.text) {
      return 'Required';
    }

    return null;
  }
}
import 'package:http/http.dart' as http;

var url = Uri.parse('https://example.com/whatsit/create');
var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'});
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');

print(await http.read(Uri.parse('https://example.com/foobar.txt')));
import 'package:flutter/material.dart';

//  Container()

void main() {
  runApp(
    MaterialApp(
      title: 'Material App',
      home: Scaffold(
        appBar: AppBar(title: Text('AppBar')),
        body: Container(
          width: 200,
          height: 300,
          color: Colors.red,
          alignment: Alignment.topLeft,
          padding: EdgeInsets.all(10),
          margin: EdgeInsets.all(20),
          child: Text(
            'Container...',
            style: TextStyle(color: Colors.black, fontSize: 20),
          ),
        ),
      ),
    ),
  );
}
...

    Container(
      //  Genişlik
      width: 200,
      //  Yükseklik
      height: 300,
      //  Renk 
      color: Colors.red,
      //  Hizalama
      alignment: Alignment.topLeft,
      //  İçten boşluk
      padding: EdgeInsets.all(10),
      //  Dıştan boşluk
      margin: EdgeInsets.all(20),
      //  Container içerisine 
      //  child: parametresi ile başka herhangi bir widget eklenebilir,
      //  o widget Container içerisinde görüntülenir.
      child: Text(
        'Container...',
        style: TextStyle(color: Colors.black, fontSize: 20),
      ),
    ),

...
void main() {

  

  

  List<int> numeros = [1,2,3,4,,,,,,];
5
  numeros.add();
6
  print( numeros );
7
  
8
  /*La palabra clave final se utiliza para codificar 
9
  los valores de la variable y no se puede modificar 
10
  en el futuro, ni ningún tipo de operación realizada 
11
  en estas variables puede alterar su valor (estado). */

  

  /* Sin tipo de datos

nombre_variable final; */

  

 /*Con tipo de datos

final data_type variable_name;*/

  

  

  final masNumeros = List.generate(20, (int index) => index );

 

  print(masNumeros);

}
Container(
                      width: 200.0,
                      height: 200.0,
                      decoration: BoxDecoration(
                        color: const Color(0xff7c94b6),
                        image: DecorationImage(
                          image: NetworkImage(
                              'https://media-exp1.licdn.com/dms/image/C5603AQEzw6Dk3IPgHA/profile-displayphoto-shrink_800_800/0/1608714667178?e=1650499200&v=beta&t=LOwP7T4YXz7as8iYcmzjrtdBcAVMBUN5hGSkSgSDl-8'),
                          fit: BoxFit.cover,
                        ),
                        borderRadius: BorderRadius.all(Radius.circular(95.0)),
                        border: Border.all(
                          color: Color(0xFFe0e0e0),
                          width: 4.0,
                        ),
                      ),
                    ),
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Modal Bottom Sheet Demo',
      home: Scaffold(
        backgroundColor: Colors.blueGrey,
        appBar: AppBar(
          title: const Text('Creating a Modal Bottom Sheet'),
          backgroundColor: Colors.black38,
        ),
        body: Builder(
          builder: (context) {
            return Center(
              child: ElevatedButton(
                child: Text('Show Modal Bottom Sheet'),
                onPressed: () {
                  showModalBottomSheet(
                    context: context,
                    builder: (context) {
                      return Wrap(
                        children: [
                          ListTile(
                            leading: Icon(Icons.share),
                            title: Text('Share'),
                          ),
                          ListTile(
                            leading: Icon(Icons.copy),
                            title: Text('Copy Link'),
                          ),
                          ListTile(
                            leading: Icon(Icons.edit),
                            title: Text('Edit'),
                          ),
                        ],
                      );
                    },
                  );
                },
              ),
            );
          },
        ),
      ),
    );
  }
}
 ListTile(
              title: Text(
                'Exit',
                style: TextStyle(
                  fontWeight: FontWeight.bold,
                  fontSize: 18,
                ),
              ),
              trailing: Icon(
                Icons.logout,
              ),
              onTap: () {
                exit(0);
              },
            ),
Column(
                          mainAxisAlignment: MainAxisAlignment.end,
                          children: [
                            SizedBox(
                              width: 200.0,
                              height: 25.0,
                              child: Container(
                                width: 200,
                                decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(10),
                                  color: Colors.red,
                                ),
                                child: Text(
                                  categoris[index].categoryName,
                                  textAlign: TextAlign.center,
                                  style: TextStyle(
                                      fontSize: 21, color: Colors.black),
                                ),
                              ),
                            ),
                          ]),
                  Text(
                    'Password',
                    style: TextStyle(
                      color: Colors.white,
                    ),
                  ),
                  Container(
                    decoration: BoxDecoration(
                      border: Border.all(color: Colors.black26),
                    ),
                    child: TextFormField(
                      decoration: InputDecoration(
                        labelText: 'Enter Password Here',
                        labelStyle: TextStyle(
                          color: Colors.white,
                          fontSize: 14,
                        ),
                        prefixIcon: Icon(Icons.lock),
                        contentPadding: EdgeInsets.all(5),
                      ),
                    ),
                  ),
        showDialog<dynamic>(
            useRootNavigator: false,
            barrierDismissible: false,
            context: context,
            builder: (BuildContext context) {
              return AlertDialog(
                title: Text(
                  Utils.getString(context, 'report_item'),
                ),
                content: TextField(
                  controller: showdialogText,
                  keyboardType: TextInputType.multiline,
                  textInputAction: TextInputAction.newline,
                  minLines: 1,
                  maxLines: 5,
                  onChanged: (value) {
                    setState(() {
                      valueText = value;
                    });
                  },
                ),
                actions: <Widget>[
                  Container(
                    padding: EdgeInsets.all(5),
                    child: Row(
                      children: <Widget>[
                        Expanded(
                          flex: 1,
                          child: ElevatedButton.icon(
                            icon: const Icon(Icons.cancel),
                            label: Text(
                              Utils.getString(context, 'cancel'),
                            ),
                            onPressed: () {
                              Navigator.of(context).pop();
                            },
                            style: ElevatedButton.styleFrom(
                              primary: Colors.red,
                              onPrimary: Colors.white,
                            ),
                          ),
                        ),
                        const SizedBox(width: 5),
                        Expanded(
                            flex: 1,
                            child: ElevatedButton.icon(
                              icon: const Icon(Icons.save),
                              label: Text(
                                Utils.getString(context, 'save'),
                              ),
                              onPressed: () async {
                                await PsProgressDialog.showDialog(context);
                                final UserReportItemParameterHolder userReportItemParameterHolder = UserReportItemParameterHolder(
                                  itemId: widget.itemId,
                                  reportedUserId: widget.reportedUserId,
                                  message: valueText,
                                );
                                final PsResource<ApiStatus> _apiStatus = await widget.userProvider!.userReportItem(userReportItemParameterHolder.toMap());

                                if (_apiStatus.data != null && _apiStatus.data!.status != null) {
                                  await widget.itemDetailProvider.deleteLocalProductCacheById(widget.itemId, widget.reportedUserId);
                                }

                                PsProgressDialog.dismissDialog();
                                Navigator.pushReplacementNamed(
                                  context,
                                  RoutePaths.home,
                                );
                              },
                              style: ElevatedButton.styleFrom(
                                primary: Colors.green,
                                onPrimary: Colors.white,
                              ),
                            )),
                      ],
                    ),
                  ),
                ],
              );
            });
 body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Center(
            child: Container(
              child: ListView.builder(
                itemCount: 10,
                itemBuilder: (context, index) => Container(
                  height: 200,
                  width: 200,
                  color: Colors.blueGrey[300],
                ),
              ),
              height: 300,
              width: 400,
            ),
          ),
        ],
      ),
Container(
                                child: Text(
                                  items[index].itemName,
                                  style: TextStyle(
                                      color: Colors.black, fontSize: 30),
                                  textAlign: TextAlign.center,
                                ), //Text
                                height: 40,
                                width: 400,
                                  decoration:
                               BoxDecoration(
                  border: Border.all(color: Colors.black38, width: 3),
                  borderRadius: BorderRadius.circular(20),
                  boxShadow: [
                    BoxShadow(
                      color: Colors.black.withOpacity(0.5),
                      spreadRadius: 5,
                      blurRadius: 5,
                      offset: Offset(0, 3), // changes position of shadow
                    ),
                  ],
                  color: Colors.white,
                  image: DecorationImage(
                    image: AssetImage(filterList[index].itemImg),
                    fit: BoxFit.contain,
                  ),
                ),
child: Padding(
                        padding: EdgeInsets.all(5),
                        child: Container(
                          height: 100,
                          width: 350,
                          color: Colors.amber[700],
                          child: Text(items[index].itemName), //Text
                        ),
                      ),
child: Text(
                      categoris[index].categoryName,
                      style: TextStyle(color: Colors.black, fontSize: 40),
                      textAlign: TextAlign.center,
                    ),
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}
IconButton(
          onPressed: () {
            print('It was pressed');
          },
            tooltip: 'Menu Bar',
          iconSize: 40,
          icon: Icon(Icons.menu),
          color: Colors.black,
        )
 appBar: PreferredSize(
        preferredSize: Size.fromHeight(90),
        child: AppBar(
          title: Text(
            'About This App',
            style: TextStyle(fontSize: 28),
          ),
          centerTitle: true,
          backgroundColor: Color(0xffbf360c),
          elevation: 10,
          shadowColor: Color(0xff3f51b5),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.only(
              bottomLeft: Radius.circular(25),
              bottomRight: Radius.circular(25),
            ),
          ),
        ),
      ),
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Text_input(),
      ),
    );
body: Stack(
        children: [
          Positioned(
            bottom: 20,
            right: 10,
            height: 25,
            width: 75,
            child: ElevatedButton(
              onPressed: () {
                Navigator.pop(
                  context,
                  MaterialPageRoute(
                    builder: (builder) => Text_input(),
                  ),
                );
              },
              child: Text('Back'),
            ),
          )
        ],
      ),
Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: _buildTodoList(),
      floatingActionButton: new FloatingActionButton(
        onPressed: _pushAddTodoScreen,
        tooltip: 'Increment',
        child: new Icon(Icons.add),
        elevation: 4.0,
      ),
      bottomNavigationBar: BottomAppBar(
        child: new Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Expanded(child: IconButton(icon: Icon(Icons.home)),),
            Expanded(child: IconButton(icon: Icon(Icons.show_chart)),),
            Expanded(child: new Text('')),
            Expanded(child: IconButton(icon: Icon(Icons.tab)),),
            Expanded(child: IconButton(icon: Icon(Icons.settings)),),
          ],
        ),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    );
  }
ElevatedButton.icon(
  icon: Icon(
    Icons.search,
    color: Colors.grey.shade600,
  ),
  label: Text(
    'ElevatedButton',
    style: TextStyle(color: Colors.grey.shade600),
    textAlign: TextAlign.left,
  ),
  onPressed: () {},
  style: ButtonStyle(
    alignment: Alignment.centerLeft,
    backgroundColor:
        MaterialStateProperty.all(Colors.grey.shade300),
    shape: MaterialStateProperty.all(RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(4.0),
    )),
  ),
),

  // More   

  ElevatedButton(
  style: ElevatedButton.styleFrom(
    primary: Colors.green,
    onPrimary: Colors.white,
    shadowColor: Colors.greenAccent,
    elevation: 3,
    shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(32.0)),
    minimumSize: Size(100, 40), //////// HERE
  ),
  onPressed: () {},
  child: Text('Hey bro'),
)

 // More   
  
 ElevatedButton.icon(
  icon: Icon(
    Icons.search,
  ),
  label: Text(
    'Search',
  ),
  onPressed: () {},
  style: ButtonStyle(
    alignment: Alignment.centerLeft,
  ),
 ),
  
 TextField(
            decoration: InputDecoration(
                border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(20)),
                focusColor: Colors.amber,
                hintText: '@gmail.com',
                labelText: 'Your email',
                prefixIcon: Icon(Icons.account_circle_sharp)),
            onChanged: (value) {}),
return Scaffold(
  appBar: AppBar(
    title: const Text('Title'),
  ),
  body: const Center(
    child: Text('Test Page'),
  ),
);
class LogOutButton extends StatelessWidget {
    final String title;
    static final HexColor basicColor = HexColor('#E02B2B');
    const LogOutButton({Key? key, required this.title}) : super(key: key);

    @override
    Widget build(BuildContext context) {
        return Container(
            padding: EdgeInsets.symmetric(vertical: 20.0),
            alignment: Alignment.center,
            child: OutlinedButton(
                onPressed: (){},
                child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
           
                    children: [
                        SizedBox(width: 24, height: 24,),
                        Text(
                            title,
                            style: GoogleFonts.roboto(
                                fontWeight: FontWeight.w500,
                                fontSize: 20.0,
                                color: basicColor,
                            ),
                        ),
                        Icon(
                            Icons.logout,
                            color: basicColor,
                        )
                    ],
                ),
                style: ButtonStyle(
                    maximumSize: MaterialStateProperty.all(Size(300.0, 50.0)),
                    minimumSize: MaterialStateProperty.all(Size(200.0, 50.0)),
                    overlayColor: MaterialStateProperty.all(Colors.transparent),
                    side: MaterialStateProperty.all(
                        BorderSide(
                            color: basicColor,
                            width: 2.0,
                        )
                    ),
                    shape: MaterialStateProperty.all(
                        RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(20.0),
                        )
                    )
                    
                )
            ),
        );
    }
}
 style: ButtonStyle(
                    maximumSize: MaterialStateProperty.all(Size(300.0, 50.0)),
                    minimumSize: MaterialStateProperty.all(Size(200.0, 50.0)),
                    overlayColor: MaterialStateProperty.all(Colors.transparent),
                    side: MaterialStateProperty.all(
                        BorderSide(
                            color: basicColor,
                            width: 2.0,
                        )
                    ),
                    shape: MaterialStateProperty.all(
                        RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(20.0),
                        )
                    )
                    
                )
sdk: ">=2.12.0 <3.0.0"


Then follow the steps:

Run flutter upgrade in the terminal to upgrade Flutter
Run dart migrate to run the dart migration tool.
Solve all errors which the migration tool shows.
Run flutter pub outdated --mode=null-safety to print all outdated packages.
Run flutter pub upgrade --null-safety to upgrade all packages automatically.
Check the code for errors and solve them (Very important).
Run dart migrate again and it should now be successful. Follow the link to checkout the proposed changes.
Press the "Apply Migration" button.
Check the code for errors again and fix them.
Future<File> moveFile(File sourceFile, String newPath) async {
  try {
    // prefer using rename as it is probably faster
    return await sourceFile.rename(newPath);
  } on FileSystemException catch (e) {
    // if rename fails, copy the source file and then delete it
    final newFile = await sourceFile.copy(newPath);
    await sourceFile.delete();
    return newFile;
  }
}
android {
    defaultConfig {
        ...
        multiDexEnabled true
    }
    ...
}

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}
String shakespeareQuote = "All the world's a stage, ...";
import 'package:path_provider/path_provider.dart';
Future<void> _deleteCacheDir() async {
final cacheDir = await getTemporaryDirectory();
if (cacheDir.existsSync()) {
cacheDir.deleteSync(recursive: true);}}
final appDir = await getApplicationSupportDirectory();
if (appDir.existsSync()) {
appDir.deleteSync(recursive: true);}}
                Container(
                  height: SizeConfig.safeBlockVertical * 24,
                  width: SizeConfig.safeBlockHorizontal * 45,
                  padding: EdgeInsets.only(
                      left: SizeConfig.safeBlockHorizontal * 5,
                      right: SizeConfig.safeBlockHorizontal * 4,
                      bottom: SizeConfig.safeBlockVertical * 2),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.white,
                      gradient: RadialGradient(
                          focalRadius: 100,
                          radius: 1.5,
                          center: Alignment.bottomLeft,
                          colors: [
                            colorStyles["maslowGreen"]!.withOpacity(0.65),
                            colorStyles["maslowGreen"]!.withOpacity(0.65),
                          ],
                          stops: [
                            0.0,
                            1.0
                          ])),
                  child: _collectionName(),
                ),
InputDecoration(
   isDense: true,
   prefixIcon:Text("\$"),
   prefixIconConstraints: BoxConstraints(minWidth: 0, minHeight: 0),
),
RichText(
  text: TextSpan(
    text: 'Hello ',
    style: DefaultTextStyle.of(context).style,
    children: const <TextSpan>[
      TextSpan(text: 'bold', style: TextStyle(fontWeight: FontWeight.bold)),
      TextSpan(text: ' world!'),
    ],
  ),
)
@override
Widget build(BuildContext context) {

  return new FutureBuilder<User>(
      future: userInfo,
      builder: (BuildContext context, AsyncSnapshot<User> snapshot) 
    {
      switch(snapshot.connectionState) {
        case ConnectionState.none:
          _showDialog(context);
          return Container();
        case ConnectionState.waiting:
          return new Center(
            child: new CircularProgressIndicator());
        case ConnectionState.active:
          return new Text('');
        case ConnectionState.done:
          if(snapshot.hasError) {
            error = snapshot.error;
            _showDialog(context);
            return Container();
          } else {
            return Container();
          }
      }
  });
import 'dart:async';
import 'dart:isolate';
main() async {
  var receivePort = new ReceivePort();
  await Isolate.spawn(echo, receivePort.sendPort);
// The 'echo' isolate sends it's SendPort as the first message
  var sendPort = await receivePort.first;
var msg = await sendReceive(sendPort, "bye");
  print('received $msg');
  msg = await sendReceive(sendPort, "hello");
  print('received $msg');
}
// the entry point for the isolate
echo(SendPort sendPort) async {
  // Open the ReceivePort for incoming messages.
  var port = new ReceivePort();
// Notify any other isolates what port this isolate listens to.
  sendPort.send(port.sendPort);
await for (var msg in port) {
    var data = msg[0];
    SendPort replyTo = msg[1];
    replyTo.send(data);
    if (data == "hello") port.close();
  }
}
/// sends a message on a port, receives the response,
/// and returns the message
Future sendReceive(SendPort port, msg) {
  ReceivePort response = new ReceivePort();
  port.send([msg, response.sendPort]);
  return response.first;
}
on Windows
taskkill /F /IM dart.exe
on Mac
killall -9 dart
Future<String> readBase64(String filepath) async {
  File file = File(await getFilePath(filepath));
  String fileContent = await file.readAsString();
  return (fileContent);
}
ElevatedButton(
      child: Text('Button'),
      onPressed: () {},
      style: ElevatedButton.styleFrom({
           Color primary, // set the background color 
           Color onPrimary, 
           Color onSurface, 
           Color shadowColor, 
           double elevation, 
           TextStyle textStyle, 
           EdgeInsetsGeometry padding, 
           Size minimumSize, 
           BorderSide side, 
           OutlinedBorder shape, 
           MouseCursor enabledMouseCursor, 
           MouseCursor disabledMouseCursor, 
           VisualDensity visualDensity, 
           MaterialTapTargetSize tapTargetSize, 
           Duration animationDuration, 
           bool enableFeedback
     }),
),
Scaffold(
      appBar: AppBar(),
      body: Align(
        alignment: Alignment.topCenter,
        child: LayoutBuilder(
          builder: (BuildContext context, BoxConstraints constraints) {
            return Container(
              height: constraints.maxHeight / 2,
              width: MediaQuery.of(context).size.width / 2,
              color: Colors.red,
            );
          },
        ),
      ),
    );
TextField(
 enabled: false, // to trigger disabledBorder
 decoration: InputDecoration(
   filled: true,
   fillColor: Color(0xFFF2F2F2),
   focusedBorder: OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(4)),
     borderSide: BorderSide(width: 1,color: Colors.red),
   ),
   disabledBorder: OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(4)),
     borderSide: BorderSide(width: 1,color: Colors.orange),
   ),
   enabledBorder: OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(4)),
     borderSide: BorderSide(width: 1,color: Colors.green),
   ),
   border: OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(4)),
     borderSide: BorderSide(width: 1,)
   ),
   errorBorder: OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(4)),
     borderSide: BorderSide(width: 1,color: Colors.black)
   ),
   focusedErrorBorder: OutlineInputBorder(
     borderRadius: BorderRadius.all(Radius.circular(4)),
     borderSide: BorderSide(width: 1,color: Colors.yellowAccent)
   ),
   hintText: "HintText",
   hintStyle: TextStyle(fontSize: 16,color: Color(0xFFB3B1B1)),
   errorText: snapshot.error,
 ),
 controller: _passwordController,
 onChanged: _authenticationFormBloc.onPasswordChanged,
                            obscureText: false,
),
class AppColors {
  static MaterialColor hex(String hex) =>
      AppColors._factoryColor(AppColors._getColorHexFromStr(hex));

  static MaterialColor _factoryColor(int color) {
    return MaterialColor(color, <int, Color>{
      50: Color(color),
      100: Color(color),
      200: Color(color),
      300: Color(color),
      400: Color(color),
      500: Color(color),
      600: Color(color),
      700: Color(color),
      800: Color(color),
      900: Color(color),
    });
  }

  static int _getColorHexFromStr(String colorStr) {
    colorStr = "FF" + colorStr;
    colorStr = colorStr.replaceAll("#", "");
    int val = 0;
    int len = colorStr.length;
    for (int i = 0; i < len; i++) {
      int hexDigit = colorStr.codeUnitAt(i);
      if (hexDigit >= 48 && hexDigit <= 57) {
        val += (hexDigit - 48) * (1 << (4 * (len - 1 - i)));
      } else if (hexDigit >= 65 && hexDigit <= 70) {
        // A..F
        val += (hexDigit - 55) * (1 << (4 * (len - 1 - i)));
      } else if (hexDigit >= 97 && hexDigit <= 102) {
        // a..f
        val += (hexDigit - 87) * (1 << (4 * (len - 1 - i)));
      } else {
        val = 0xFFFFFFFF;
      }
    }
    return val;
  }
}

// Example: In your app
// ...
class MyExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
    	height: 100.0,
      	width: 100.0,
      	decoration: BoxDecoration(
    		color: AppColors.hex('#000000'),	
    ),
    );
  }
}
Column( 
  crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ Container( child: Text('${payment.name}',textAlign: TextAlign.left,), color: Colors.redAccent, ), ...... )
 decoration: BoxDecoration(
          border: Border(
            top: BorderSide(width: 16.0, color: Colors.lightBlue.shade600),
            bottom: BorderSide(width: 16.0, color: Colors.lightBlue.shade900),
          ),
          color: Colors.white,
        ),
extension StringExtension on String {
    String capitalize() {
      return "${this[0].toUpperCase()}${this.substring(1)}";
    }
}
appBar: AppBar(
        automaticallyImplyLeading: false,
        title: Text(signedIn ? 'Home' : 'Sign In'),
      ),
Container(
      height: 120.0,
      width: 120.0,
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage(
              'assets/assets/alucard.jpg'),
          fit: BoxFit.fill,
        ),
        shape: BoxShape.circle,
      ),
    )
const color = const Color(0xffb74093); // Second `const` is optional in assignments.
Text(
  'Hello world',
  style: TextStyle(
    decoration: TextDecoration.underline,
  ),
)
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(title: Text('IntrinsicWidth')),
    body: Center(
      child: IntrinsicWidth(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            RaisedButton(
              onPressed: () {},
              child: Text('Short'),
            ),
            RaisedButton(
              onPressed: () {},
              child: Text('A bit Longer'),
            ),
            RaisedButton(
              onPressed: () {},
              child: Text('The Longest text button'),
            ),
          ],
        ),
      ),
    ),
  );
}
try {
      final result = await InternetAddress.lookup('google.com');
      if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
          print(' connected');
      }
    } on SocketException catch (_) {
      //NOT connected to the internet
      print('not connected');
    }
  class MyBlinkingButton extends StatefulWidget {
    @override
    _MyBlinkingButtonState createState() => _MyBlinkingButtonState();
  }

  class _MyBlinkingButtonState extends State<MyBlinkingButton>
      with SingleTickerProviderStateMixin {
    AnimationController _animationController;

    @override
    void initState() {
      _animationController =
          new AnimationController(vsync: this, duration: Duration(seconds: 1));
      _animationController.repeat(reverse: true);
      super.initState();
    }

    @override
    Widget build(BuildContext context) {
      return FadeTransition(
        opacity: _animationController,
        child: MaterialButton(
          onPressed: () => null,
          child: Text("Text button"),
          color: Colors.green,
        ),
      );
    }

    @override
    void dispose() {
      _animationController.dispose();
      super.dispose();
    }
  }
List<String> feed = List();

feed.add("AAAA");
feed.add("BBBB");
feed.add("CCCC");

ListView.builder(
  itemCount: feed.length,
  itemBuilder: (context, index) {
    return ListTile(title: feed[feed.length - 1 -index]);
  },
);
import 'dart:math';

void main() {
  print(getRandomString(5));  // 5GKjb
  print(getRandomString(10)); // LZrJOTBNGA
  print(getRandomString(15)); // PqokAO1BQBHyJVK
}

const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
Random _rnd = Random();

String getRandomString(int length) => String.fromCharCodes(Iterable.generate(
    length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));
import 'dart:io';
import 'package:exif/exif.dart';
import 'package:image/image.dart' as img;

Future<File> fixExifRotation(String imagePath) async {
    final originalFile = File(imagePath);
    List<int> imageBytes = await originalFile.readAsBytes();

    final originalImage = img.decodeImage(imageBytes);

    final height = originalImage.height;
    final width = originalImage.width;

    // Let's check for the image size
    // This will be true also for upside-down photos but it's ok for me
    if (height >= width) {
      // I'm interested in portrait photos so
      // I'll just return here
      return originalFile;
    }

    // We'll use the exif package to read exif data
    // This is map of several exif properties
    // Let's check 'Image Orientation'
    final exifData = await readExifFromBytes(imageBytes);

    img.Image fixedImage;

    if (height < width) {
      logger.logInfo('Rotating image necessary');
      // rotate
      if (exifData['Image Orientation'].printable.contains('Horizontal')) {
        fixedImage = img.copyRotate(originalImage, 90);
      } else if (exifData['Image Orientation'].printable.contains('180')) {
        fixedImage = img.copyRotate(originalImage, -90);
      } else if (exifData['Image Orientation'].printable.contains('CCW')) {
        fixedImage = img.copyRotate(originalImage, 180);
      } else {
        fixedImage = img.copyRotate(originalImage, 0);
      }
    }

    // Here you can select whether you'd like to save it as png
    // or jpg with some compression
    // I choose jpg with 100% quality
    final fixedFile =
        await originalFile.writeAsBytes(img.encodeJpg(fixedImage));

    return fixedFile;
  }
//I think your understanding of Promises and async/await is not correct.
//When you make a function async, the await keyword before a promise make sure
//that code execution will pause until the promise fulfilled or rejected. 
//Your code can be simplified:

var currentPromise;

async function asyncFunc(promise){
    // Do some code here
    return await promise;
}

function anotherFunction(){
    asyncFunc(currentPromise);
}
//When we are calling return await promise, the execution engine waits in a
//non-blocking way until the promise fulfilled or rejected, and then it returns 
//the output to the anotherFunction function.
const placeholderServices = [
  PlaceholderService(
    name: 'Place Kitten',
    description:
        'Use the Internet first-class citizens as placeholders for your Website.',
    url: 'https://placekitten.com',
    pictureUrl: 'https://placekitten.com/1024/768',
    tags: ['Fun', 'Grayscale'],
  ),
  PlaceholderService(
    name: 'Fill Murray',
    description:
        'Iconic pictures of Bill Murray. Also by the same author: PlaceCage and Steven SeGallery.',
    url: 'http://www.fillmurray.com',
    pictureUrl: 'http://www.fillmurray.com/1200/900',
    tags: ['Fun', 'Grayscale', 'Open-source'],
  ),
  PlaceholderService(
    name: 'PlaceIMG',
    description:
        'Returns stock photos for a given theme, like "Architecture", "Tech" or "People". Also support sepia filter.',
    url: 'http://placeimg.com',
    pictureUrl: 'http://placeimg.com/1200/900/arch',
    tags: ['Stock photo', 'Grayscale', 'Sepia', 'Themes'],
  ),
  PlaceholderService(
    name: 'Bacon Mockup',
    description:
        'Bacon images, but not only. Also on display: briskets, pulled pork, drumsticks, ribs, etc.',
    url: 'https://baconmockup.com',
    pictureUrl: 'https://baconmockup.com/1200/900',
    tags: ['Fun'],
  ),
  PlaceholderService(
    name: 'Placemat',
    description:
        'Stock images categorized in 3 themes: "People", "Places" and "Things. Various options of customization: text, overlay, random seed.',
    url: 'https://placem.at',
    pictureUrl: 'https://placem.at/things?w=1200&h=900',
    tags: ['Stock photo', 'Text', 'Themes', 'Overlay'],
  ),
  PlaceholderService(
    name: 'Dynamic Dummy Image Generator',
    description:
        'More developer-oriented, this service returns plain mono-color images. Lots of handy options including shortcuts for different screen or ads resolutions.',
    url: 'https://dummyimage.com',
    pictureUrl: 'https://dummyimage.com/1200x900/bada55/ffffff',
    tags: ['Technical', 'Text', 'Formats'],
  ),
  PlaceholderService(
    name: 'lorempixel',
    description:
        'Another stock photo placeholder service. Note the "Abstract" category because sometimes you just want your image to represent nothing.',
    url: 'http://lorempixel.com',
    pictureUrl: 'http://lorempixel.com/1200/900/sports',
    tags: ['Stock photo', 'Text', 'Grayscale', 'Themes'],
  ),
];
Widget _signInButton() {




   return OutlineButton(


     splashColor: Colors.grey,


     onPressed: () {},


     shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)),


     highlightElevation: 0,


     borderSide: BorderSide(color: Colors.grey),


     child: Padding(


       padding: const EdgeInsets.fromLTRB(0, 10, 0, 10),


       child: Row(


         mainAxisSize: MainAxisSize.min,


         mainAxisAlignment: MainAxisAlignment.center,


         children: <Widget>[


           Image(image: AssetImage("assets/google_logo.png"), height: 35.0),


           Padding(


             padding: const EdgeInsets.only(left: 10),


             child: Text(


               'Sign in with Google',


               style: TextStyle(


                 fontSize: 20,


                 color: Colors.grey,


               ),


             ),


           )


         ],


       ),


     ),


   );


 }


Text('Click \u{2795} to add')
RichText( text: TextSpan( children: [ TextSpan( text: "Click ", ), WidgetSpan( child: Icon(Icons.add, size: 14), ), TextSpan( text: " to add", ), ], ), )
Center(
          child: new Container(
            padding: const EdgeInsets.all(8.0),
            height: 500.0,
            width: 500.0,
            child: new Stack(
              overflow: Overflow.visible,
              children: <Widget>[
                new Icon(Icons.pages, size: 36.0, color: Colors.red),
                new Positioned(
                  left: 20.0,
                  child: new Icon(Icons.pages, size: 36.0, color: Colors.green),
                ),
 
              ],
            ),
          ),
    )
main() {
  List customers = [];
  customers.add(Customer('Jack', 23));
  customers.add(Customer('Adam', 27));
  customers.add(Customer('Katherin', 25));

  customers.sort((a, b) => a.age.compareTo(b.age));
  print('Sort by Age: ' + customers.toString());

  customers.sort((a, b) => a.name.compareTo(b.name));
  print('Sort by Name: ' + customers.toString());
}
//Inside main.dart
return MaterialApp(
 initialRoute: WelcomeScreen.id,
 routes: {
   WelcomeScreen.id: (context) => WelcomeScreen(),
   LoginScreen.id: (context) => LoginScreen(),
   RegistrationScreen.id: (context) => RegistrationScreen(),
   ChatScreen.id: (context) => ChatScreen(),
 },
);

//Inside **** Class:
static const String id = '****';

//Inside onPressed
  onTap: () => Navigator.pushNamed(context, VideoScreen.id, arguments: {
                'chapter_name': 'Chapter $index',
              }),
              
 // In receiving side
 final  Map<String, String> received = ModalRoute.of(context).settings.arguments;
    final chapterName = received['chapter_name'];
 
import 'package:dynamicmathapp/services/auth.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:dynamicmathapp/models/user.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

class Home extends StatelessWidget {
  final AuthService _auth = AuthService();
  final ref = FirebaseDatabase.instance.reference();

  @override
  Widget build(BuildContext context) {
    User user = Provider.of<User>(context);

    return Scaffold(
      backgroundColor: Colors.brown[50],
      appBar: AppBar(
        title: Text('Welcome'),
        backgroundColor: Colors.brown[400],
        elevation: 0.0,
        actions: <Widget>[
          FlatButton.icon(
            icon: Icon(Icons.person),
            label: Text('logout'),
            onPressed: () async {
              await _auth.signOut();
            },
          ),
        ],
      ),
      body: Column(
        children: <Widget>[
          Container(
            child: Text(
              'ID:' + user.uid + 'email:' + user.email,
            ),
          ),
          RaisedButton(
            child: Text('Create Record'),
            onPressed: () {
              createRecord();
            },
          ),
          RaisedButton(
            child: Text('View Record'),
            onPressed: () {
              getData();
            },
          ),
          RaisedButton(
            child: Text('Update Record'),
            onPressed: () {
              updateData();
            },
          ),
          RaisedButton(
            child: Text('Delete Record'),
            onPressed: () {
              deleteData();
            },
          ),
        ],
      ),
    );
  }

  void createRecord() {
    ref
        .child('videos')
        .child('class_10')
        .child('chapter_1')
        .set([
      {"length": "1:3333", "title": "Introduction 1.1"},
      {"length": "2:30", "title": "Introduction 1.2"}
    ]);
  }

  void getData() {
    ref
        .child('videos')
        .child('class_10')
        .child('chapter_1')
        .once()
        .then((DataSnapshot data) {
      print(data..value);
      print(data.key);
    });
  }

  void updateData() {}

  void deleteData() {}
}
final ref = FirebaseDatabase.instance.reference();

 void getData() {
    ref
        .child('videos')
        .child('class_10')
        .child('chapter_1')
        .once()
        .then((DataSnapshot data) {
      print(data.value);
      print(data.key);
    });
  }
  
    void createRecord() {
    ref
        .child('videos')
        .child('class_10')
        .child('chapter_1')
        .set([
      {"length": "1:3333", "title": "Introduction 1.1"},
      {"length": "2:30", "title": "Introduction 1.2"}
    ]);
  }
   final databaseReference = Firestore.instance;

 
 void createRecord() async {
    Map data = {'length': '1:30:20', 'position': '1', 'title': 'Introduction 3.'};
    await databaseReference
        .collection("class_10")
        .document('chapter_4')
        .collection('videos')
        .document()
        .setData(
           data
);

//    await databaseReference.collection("classes")
//        .document('10')
//        .collection('chapter')
//        .document('1')
//    .collection('videos')
//    .document('1')
//        .setData({
//      'title': 'Introduction 1 Sets',
//      'length': '10:20'
//    });
  }

  void getData() {
    databaseReference
        .collection("class_10")
        .document('chapter_1')
        .collection('videos')
        .getDocuments()
        .then((QuerySnapshot snapshot) {
      snapshot.documents.forEach((f) => print('${f.data}}'));
    });
  }

  void updateData() {
    try {
      databaseReference
          .collection('books')
          .document('1')
          .updateData({'description': 'Head First Flutter'});
    } catch (e) {
      print(e.toString());
    }
    databaseReference
        .collection("classes")
        .document('10')
        .collection('chapter')
        .document('1')
        .collection('videos');
  }

  void deleteData() {
    try {
      databaseReference.collection('books').document('1').delete();
    } catch (e) {
      print(e.toString());
    }
  }
bool isAnagram(String str1, String str2) {
  String normalize(String str) => (str
          .toLowerCase()
          .replaceAll(RegExp(r'[^a-z0-9]', caseSensitive: false), '')
          .split('')
            ..sort())
      .join('');
  return normalize(str1) == normalize(str2);
}
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(title: Text('IntrinsicWidth')),
    body: Center(
      child: IntrinsicHeight(
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            RaisedButton(
              onPressed: () {},
              child: Text('Short'),
            ),
            RaisedButton(
              onPressed: () {},
              child: Text('A bit Longer'),
            ),
            RaisedButton(
              onPressed: () {},
              child: Text('The Longest text button'),
            ),
          ],
        ),
      ),
    ),
  );
}
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(title: Text('IntrinsicWidth')),
    body: Center(
      child: IntrinsicWidth(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            RaisedButton(
              onPressed: () {},
              child: Text('Short'),
            ),
            RaisedButton(
              onPressed: () {},
              child: Text('A bit Longer'),
            ),
            RaisedButton(
              onPressed: () {},
              child: Text('The Longest text button'),
            ),
          ],
        ),
      ),
    ),
  );
}
import 'package:flutter/material.dart';

void main() {
  runApp(
    new MaterialApp(
      title: 'Hello World App',
      home: new myApp(),
    )
  );
}

class myApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('Hello World App'),
      ),
      body: new Center(
        child: new Text(
          'Hello, world!'
        ),
      ),
    );
  }
}
Text("Border test",
    style: TextStyle(
      inherit: true,
      fontSize: 48.0,
      color: Colors.pink,
      shadows: [
        Shadow( // bottomLeft
          offset: Offset(-1.5, -1.5),
          color: Colors.white
        ),
        Shadow( // bottomRight
          offset: Offset(1.5, -1.5),
          color: Colors.white
        ),
        Shadow( // topRight
          offset: Offset(1.5, 1.5),
          color: Colors.white
        ),
        Shadow( // topLeft
          offset: Offset(-1.5, 1.5),
          color: Colors.white
        ),
      ]
    ),
);
String capitalize(String s) {
  if (s == null || s.isEmpty) {
    return s;
  }
  return s.length < 1 ? s.toUpperCase() : s[0].toUpperCase() + s.substring(1);
}
star

Tue Mar 21 2023 07:34:59 GMT+0000 (UTC)

#flutter #dart
star

Tue Mar 21 2023 07:34:30 GMT+0000 (UTC)

#flutter #dart
star

Thu Feb 16 2023 11:01:26 GMT+0000 (UTC) https://stackoverflow.com/questions/69482360/flutter-open-modal-bottom-sheet-on-bottom-navigation-bar-item-click

#dart #flutter
star

Wed Feb 15 2023 18:26:11 GMT+0000 (UTC)

#dart #flutter
star

Thu Feb 09 2023 10:45:09 GMT+0000 (UTC) https://stackoverflow.com/questions/68455825/flutter-chat-screen-built-with-a-streambuilder-showing-messages-multiple-times

#dart
star

Mon Dec 19 2022 12:58:22 GMT+0000 (UTC) https://stackoverflow.com/questions/51579546/how-to-format-datetime-in-flutter

#dart
star

Tue Nov 08 2022 10:52:17 GMT+0000 (UTC) https://codingwithtashi.medium.com/isoltate-flutter-dart-multithreading-cf5f67de9b46

#flutter #dart
star

Sun Nov 06 2022 16:07:53 GMT+0000 (UTC) https://stackoverflow.com/questions/69779734/navigator-pushreplacement-error-in-flutter

#dart
star

Sat Nov 05 2022 22:44:41 GMT+0000 (UTC) https://stackoverflow.com/questions/22274033/how-do-i-split-or-chunk-a-list-into-equal-parts-with-dart

#dart
star

Fri Nov 04 2022 13:58:46 GMT+0000 (UTC) https://www.fluttercampus.com/guide/345/clear-navigation-history-stack-flutter/

#dart
star

Fri Nov 04 2022 13:58:29 GMT+0000 (UTC) https://www.fluttercampus.com/guide/345/clear-navigation-history-stack-flutter/

#dart
star

Wed Oct 26 2022 20:11:58 GMT+0000 (UTC) https://stackoverflow.com/questions/44991968/how-can-i-dismiss-the-on-screen-keyboard

#dart
star

Wed Oct 19 2022 04:21:14 GMT+0000 (UTC) https://medium.com/@mibcoder/folder-creation-in-flutter-a554c238b7e8

#dart #flutter
star

Mon Oct 10 2022 22:46:16 GMT+0000 (UTC) https://www.fluttercampus.com/guide/176/how-to-make-multi-line-textfield-input-textarea-in-flutter/

#dart #flutter
star

Thu Oct 06 2022 15:54:44 GMT+0000 (UTC)

#dart #flutter #bloc #page #view
star

Thu Oct 06 2022 14:58:50 GMT+0000 (UTC)

#dart #flutter #bloc #page #view
star

Thu Oct 06 2022 14:19:52 GMT+0000 (UTC)

#dart #flutter #bloc #page #view
star

Thu Oct 06 2022 14:18:34 GMT+0000 (UTC)

#dart #flutter #bloc #page #view
star

Thu Oct 06 2022 11:22:44 GMT+0000 (UTC)

#dart #flutter #bloc #page #view
star

Thu Sep 15 2022 11:13:33 GMT+0000 (UTC) https://stackoverflow.com/questions/68577939/how-to-upload-image-along-with-text-typed-in-textbox-in-flutter

#dart
star

Tue Aug 30 2022 14:48:19 GMT+0000 (UTC)

#dart
star

Sat Aug 27 2022 13:04:41 GMT+0000 (UTC)

#flutter #dart
star

Thu Jul 21 2022 09:37:04 GMT+0000 (UTC)

#flutter #dart
star

Fri Jul 15 2022 09:15:03 GMT+0000 (UTC) https://stackoverflow.com/questions/67338711/dart-process-run-get-stdout-as-stream-instead-of-string-just-like-process

#dart
star

Fri Jul 15 2022 09:14:54 GMT+0000 (UTC) https://stackoverflow.com/questions/67338711/dart-process-run-get-stdout-as-stream-instead-of-string-just-like-process

#dart
star

Thu Jul 14 2022 04:59:44 GMT+0000 (UTC)

#flutter #dart
star

Thu Jul 14 2022 03:18:54 GMT+0000 (UTC) https://www.geeksforgeeks.org/urls-in-flutter/

#dart
star

Mon Jun 27 2022 08:33:18 GMT+0000 (UTC) https://stackoverflow.com/questions/60697579/how-to-handle-spamming-button-click-in-a-flutter-app

#dart
star

Fri Jun 24 2022 21:23:25 GMT+0000 (UTC) https://stackoverflow.com/questions/70656628/flutterfire-configure-command-not-working-i-need-to-set-firebase-in-my-flutte

#dart
star

Thu Jun 23 2022 21:48:21 GMT+0000 (UTC) https://stackoverflow.com/questions/56034572/how-to-manage-global-textscalefactor-in-flutter-app-properly

#dart
star

Thu Jun 23 2022 10:54:49 GMT+0000 (UTC) https://firebase.google.com/docs/storage/flutter/upload-files

#dart
star

Tue Jun 21 2022 21:13:03 GMT+0000 (UTC) https://stackoverflow.com/questions/53973333/flutter-picking-wrong-keystore-path-and-giving-error-key-jks-not-found

#dart
star

Sun Jun 19 2022 15:36:56 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:36:08 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:34:08 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:28:58 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:27:53 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:26:30 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:25:24 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:24:22 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:23:13 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:22:15 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:20:19 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:18:38 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:17:38 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:05:52 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:05:03 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:04:07 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 15:00:27 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 14:57:57 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 14:55:46 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 14:53:57 GMT+0000 (UTC)

#dart
star

Sun Jun 19 2022 13:59:53 GMT+0000 (UTC)

#dart
star

Fri Jun 17 2022 15:44:27 GMT+0000 (UTC)

#dart
star

Fri Jun 17 2022 15:26:07 GMT+0000 (UTC) https://stackoverflow.com/questions/69092164/http-post-request-doesnt-work-for-my-flutter-app-code

#dart
star

Fri Jun 17 2022 08:29:30 GMT+0000 (UTC) https://stackoverflow.com/questions/14268967/how-do-i-list-the-contents-of-a-directory-with-dart

#dart
star

Wed Jun 08 2022 20:33:24 GMT+0000 (UTC) https://stackoverflow.com/questions/51845559/generate-sha-1-for-flutter-react-native-android-native-app

#dart
star

Fri May 27 2022 06:04:14 GMT+0000 (UTC) https://stackoverflow.com/questions/53577962/better-way-to-load-images-from-network-flutter

#dart #flutter
star

Tue May 24 2022 20:56:04 GMT+0000 (UTC) https://stackoverflow.com/questions/54437448/charts-flutter-labels-text-on-x-axis-overlapping-each-other

#dart #flutter
star

Wed May 18 2022 11:55:09 GMT+0000 (UTC)

#dart
star

Wed May 18 2022 11:53:20 GMT+0000 (UTC)

#dart
star

Wed May 18 2022 09:46:22 GMT+0000 (UTC)

#dart
star

Wed May 18 2022 09:32:26 GMT+0000 (UTC)

#dart
star

Tue May 17 2022 12:22:20 GMT+0000 (UTC)

#dart
star

Tue May 17 2022 12:14:36 GMT+0000 (UTC)

#dart
star

Tue May 17 2022 09:16:37 GMT+0000 (UTC)

#dart
star

Tue May 17 2022 09:13:26 GMT+0000 (UTC)

#dart
star

Tue May 17 2022 09:04:43 GMT+0000 (UTC)

#dart
star

Tue May 17 2022 08:45:13 GMT+0000 (UTC)

#dart
star

Mon May 16 2022 12:53:00 GMT+0000 (UTC)

#dart
star

Sun May 15 2022 01:52:58 GMT+0000 (UTC) https://stackoverflow.com/questions/65872585/flutter-cant-load-image-from-url

#dart
star

Sun May 15 2022 01:52:54 GMT+0000 (UTC) https://stackoverflow.com/questions/65872585/flutter-cant-load-image-from-url

#dart
star

Fri May 13 2022 08:44:30 GMT+0000 (UTC) https://stackoverflow.com/questions/63103065/flutter-sqflite-databaseexceptionno-such-table-project

#dart
star

Sun Apr 17 2022 02:30:37 GMT+0000 (UTC) https://flutterigniter.com/build-widget-with-async-method-call/

#dart
star

Fri Apr 15 2022 12:30:23 GMT+0000 (UTC) https://www.google.com/search?q

#dart
star

Mon Apr 11 2022 15:43:42 GMT+0000 (UTC) https://stackoverflow.com/questions/57878887/using-flutter-webview-as-home-and-pressing-back-button-closes-application

#dart
star

Tue Apr 05 2022 11:46:23 GMT+0000 (UTC)

#flutter #dart
star

Fri Apr 01 2022 16:21:22 GMT+0000 (UTC) https://pub.dev/packages/http

#dart
star

Fri Mar 25 2022 18:27:16 GMT+0000 (UTC) https://github.com/lesnitsky/todolist_flutter

#dart
star

Sun Mar 20 2022 23:56:38 GMT+0000 (UTC)

#dart
star

Sun Mar 20 2022 23:55:04 GMT+0000 (UTC)

#dart
star

Sun Mar 13 2022 09:05:30 GMT+0000 (UTC) https://dartpad.dev/?id

#dart
star

Sat Feb 26 2022 04:37:33 GMT+0000 (UTC) web.Roblox.com

#java #actionscript3 #dart #css #bash
star

Sat Feb 19 2022 05:43:45 GMT+0000 (UTC)

#flutter #dart
star

Thu Feb 17 2022 00:23:21 GMT+0000 (UTC) https://blog.logrocket.com/flutter-modal-bottom-sheet-tutorial-with-examples/

#dart
star

Sun Feb 13 2022 20:38:55 GMT+0000 (UTC)

#flutter #dart
star

Fri Feb 11 2022 08:09:17 GMT+0000 (UTC) https://imgur.com/a/gMhKD7B

#flutter #dart
star

Wed Feb 09 2022 18:54:34 GMT+0000 (UTC) https://imgur.com/a/TrU40gV

#flutter #dart
star

Wed Feb 09 2022 08:26:10 GMT+0000 (UTC)

#dart #flutter
star

Sun Jan 30 2022 11:39:22 GMT+0000 (UTC)

#flutter #dart
star

Sun Jan 30 2022 09:21:01 GMT+0000 (UTC)

#flutter #dart
star

Sun Jan 30 2022 08:43:08 GMT+0000 (UTC)

#flutter #dart
star

Fri Jan 28 2022 16:49:28 GMT+0000 (UTC) https://stackoverflow.com/questions/63873338/what-does-widgetsflutterbinding-ensureinitialized-do

#dart #flutter
star

Tue Jan 25 2022 14:02:13 GMT+0000 (UTC)

#flutter #dart
star

Sun Jan 23 2022 19:33:41 GMT+0000 (UTC)

#dart #flutter
star

Sun Jan 23 2022 10:05:33 GMT+0000 (UTC)

#dart #flutter
star

Sun Jan 23 2022 08:57:24 GMT+0000 (UTC) https://www.youtube.com/watch?v=EgtPleVwxBQ&t=64s

#dart #flutter
star

Fri Jan 21 2022 22:03:03 GMT+0000 (UTC) https://pub.dev/packages/persistent_bottom_nav_bar

#dart
star

Fri Jan 21 2022 21:57:58 GMT+0000 (UTC)

#dart
star

Fri Jan 21 2022 20:22:34 GMT+0000 (UTC)

#dart #flutter
star

Sun Jan 16 2022 12:45:42 GMT+0000 (UTC)

#dart
star

Tue Dec 28 2021 10:26:07 GMT+0000 (UTC)

#dart #listtile
star

Tue Dec 28 2021 10:18:36 GMT+0000 (UTC)

#dart
star

Sun Dec 05 2021 07:45:02 GMT+0000 (UTC) https://stackoverflow.com/questions/64797607/how-do-i-upgrade-an-existing-flutter-app

#dart
star

Mon Nov 01 2021 15:52:52 GMT+0000 (UTC) https://stackoverflow.com/questions/54692763/flutter-how-to-move-file

#dart
star

Mon Nov 01 2021 11:23:17 GMT+0000 (UTC) https://stackoverflow.com/questions/68015014/flutter-error-filesystemexception-creation-failed-path-storage-emulated-0

#dart
star

Wed Oct 20 2021 05:23:33 GMT+0000 (UTC) https://stackoverflow.com/questions/57000166/how-to-sort-order-a-list-by-date-in-dart-flutter

#dart
star

Sat Oct 16 2021 10:14:33 GMT+0000 (UTC) https://stackoverflow.com/questions/55591958/flutter-firestore-causing-d8-cannot-fit-requested-classes-in-a-single-dex-file

#dart
star

Fri Oct 15 2021 23:46:56 GMT+0000 (UTC) https://api.dart.dev/stable/2.14.4/dart-core/dart-core-library.html

#dart
star

Sat Oct 02 2021 12:02:39 GMT+0000 (UTC) https://stackoverflow.com/questions/53296899/how-to-clear-app-cache-programmatically-on-flutter

#dart
star

Fri Sep 24 2021 02:03:52 GMT+0000 (UTC)

#dart
star

Sat Sep 18 2021 00:29:49 GMT+0000 (UTC) https://stackoverflow.com/questions/58819979/is-there-a-way-to-create-a-text-field-with-a-prefix-that-is-always-visible-in-fl

#dart #flutter
star

Tue Sep 14 2021 15:43:06 GMT+0000 (UTC) https://api.flutter.dev/flutter/widgets/RichText-class.html

#dart #flutter
star

Tue Sep 14 2021 04:23:19 GMT+0000 (UTC) https://stackoverflow.com/questions/54135078/how-to-solve-error-running-pod-install-in-flutter-on-mac

#dart #flutter
star

Fri Aug 27 2021 05:58:23 GMT+0000 (UTC) https://medium.com/flutter-community/flutter-threading-5c3a7b0c065f

#flutter #dart
star

Fri Aug 27 2021 05:28:55 GMT+0000 (UTC) https://medium.com/flutterdevs/threading-in-flutter-e5b84c7d8d31

#flutter #dart #threading
star

Mon Jul 26 2021 06:39:40 GMT+0000 (UTC) https://stackoverflow.com/questions/51679269/waiting-for-another-flutter-command-to-release-the-startup-lock

#dart
star

Sun Jul 04 2021 12:02:09 GMT+0000 (UTC) https://gist.github.com/matteocrippa/3a8b84c7b49c10bc070e58a66860e83f#file-flutter-md

#flutter #dart
star

Sun Jul 04 2021 12:00:39 GMT+0000 (UTC) https://github.com/Temidtech/Flutter-Cheat-Sheet/blob/master/README.md

#dart #flutter
star

Fri Jun 18 2021 08:38:14 GMT+0000 (UTC)

#dart
star

Tue May 11 2021 12:01:16 GMT+0000 (UTC) https://stackoverflow.com/questions/66835173/how-to-change-background-color-of-elevated-button-in-flutter-from-function

#dart
star

Sun May 02 2021 14:29:08 GMT+0000 (UTC) https://stackoverflow.com/questions/54156365/sizing-a-container-to-exact-half-the-screen-size-in-flutter

#dart
star

Sat Apr 24 2021 17:17:34 GMT+0000 (UTC) https://medium.com/flutterdevs/chip-widgets-in-flutter-7a2d3d34597c

#flutt #dart #chips
star

Fri Apr 23 2021 17:34:56 GMT+0000 (UTC) https://stackoverflow.com/questions/50122394/not-able-to-change-textfield-border-color

#dart #flutter
star

Fri Apr 23 2021 02:25:58 GMT+0000 (UTC)

#dart #flutter
star

Sat Apr 10 2021 06:33:52 GMT+0000 (UTC)

#dart #flutter
star

Thu Mar 25 2021 15:10:11 GMT+0000 (UTC) https://fluttercentral.com/Articles/Post/1056/How_to_add_a_border_to_only_one_part_of_the_container_in_Flutter

#dart #flutter
star

Mon Mar 22 2021 10:50:27 GMT+0000 (UTC) https://stackoverflow.com/questions/29628989/how-to-capitalize-the-first-letter-of-a-string-in-dart

#dart #flutter
star

Wed Mar 17 2021 13:56:41 GMT+0000 (UTC) https://github.com/flutter/flutter/issues/67277

#dart #flutter
star

Tue Mar 16 2021 16:29:48 GMT+0000 (UTC) https://stackoverflow.com/questions/52211283/inserting-image-into-a-container-flutter-app

#dart #flutter
star

Mon Mar 15 2021 10:38:42 GMT+0000 (UTC) https://stackoverflow.com/questions/50081213/how-do-i-use-hexadecimal-color-strings-in-flutter

#dart #flutter
star

Thu Mar 11 2021 14:20:12 GMT+0000 (UTC) https://stackoverflow.com/questions/50614661/how-to-underline-text-in-flutter

#dart #flutter
star

Mon Mar 08 2021 13:00:55 GMT+0000 (UTC) https://medium.com/flutter-community/flutter-layout-cheat-sheet-5363348d037e

#dart #flutter
star

Fri Mar 05 2021 16:23:34 GMT+0000 (UTC) https://pub.dev/

#dart
star

Fri Dec 11 2020 13:38:42 GMT+0000 (UTC)

#dart
star

Fri Dec 04 2020 20:33:23 GMT+0000 (UTC) https://stackoverflow.com/questions/51733044/flutter-blinking-button

#dart
star

Fri Oct 30 2020 01:10:04 GMT+0000 (UTC) https://stackoverflow.com/questions/57499254/flutter-reversed-listview-start-at-top

#dart
star

Thu Oct 29 2020 18:41:27 GMT+0000 (UTC) https://stackoverflow.com/questions/61919395/how-to-generate-random-string-in-dart

#dart
star

Thu Oct 29 2020 16:33:00 GMT+0000 (UTC) https://stackoverflow.com/questions/60176001/how-to-fix-wrong-rotation-of-photo-from-camera-in-flutter

#dart
star

Fri Sep 11 2020 07:50:15 GMT+0000 (UTC)

#dart
star

Sun Aug 23 2020 19:51:15 GMT+0000 (UTC)

#dart
star

Mon Jun 15 2020 12:36:30 GMT+0000 (UTC)

#dart
star

Mon Jun 15 2020 12:36:06 GMT+0000 (UTC) https://pusher.com/tutorials/flutter-listviews

#dart
star

Mon Jun 15 2020 12:35:38 GMT+0000 (UTC)

#dart
star

Mon Jun 15 2020 12:34:47 GMT+0000 (UTC) https://pub.dev/packages/flutter_svg#-readme-tab-

#dart
star

Mon Jun 15 2020 12:34:17 GMT+0000 (UTC) https://www.freewebmentor.com/questions/does-flutter-support-negative-margin

#dart
star

Mon Jun 15 2020 12:33:46 GMT+0000 (UTC) Dart/Flutter List Tutorial with Examples

#dart
star

Mon Jun 15 2020 12:33:08 GMT+0000 (UTC)

#dart
star

Mon Jun 15 2020 12:31:36 GMT+0000 (UTC)

#dart
star

Sun Jun 14 2020 07:37:22 GMT+0000 (UTC)

#dart
star

Sun Jun 14 2020 07:08:20 GMT+0000 (UTC) https://petercoding.com/firebase/2020/02/06/get-started-with-firebase-in-flutter/

#dart
star

Sun Jun 14 2020 03:21:06 GMT+0000 (UTC)

#dart
star

Tue May 12 2020 11:03:36 GMT+0000 (UTC) https://gist.github.com/basselch/51b8a047c5c86355c5859a2e5f198fd0

#dart #flutter
star

Tue May 12 2020 11:02:17 GMT+0000 (UTC) https://stackoverflow.com/questions/48893935/how-to-remove-debug-banner-in-flutter-on-android-emulator

#dart #flutter
star

Tue Apr 28 2020 19:52:02 GMT+0000 (UTC) https://www.30secondsofcode.org/dart/s/is-anagram/

#dart
star

Wed Jan 22 2020 18:43:41 GMT+0000 (UTC) https://medium.com/flutter-community/flutter-layout-cheat-sheet-5363348d037e

#dart #flutter #layouts
star

Wed Jan 22 2020 18:35:33 GMT+0000 (UTC) https://medium.com/flutter-community/flutter-layout-cheat-sheet-5363348d037e

#dart #flutter #layout
star

Sun Dec 29 2019 19:42:22 GMT+0000 (UTC) https://kodestat.gitbook.io/flutter/flutter-hello-world

#android #dart #flutter #ios #helloworld
star

Thu Dec 26 2019 18:27:15 GMT+0000 (UTC) https://stackoverflow.com/questions/52146269/how-to-decorate-text-stroke-in-flutter

#dart #flutter #howto

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension