Skip to content

Instantly share code, notes, and snippets.

@manofi21
manofi21 / a. how to install Windows in MV.md
Last active July 31, 2023 05:48
medium_source_and_todo_list.md #Daily
@slightfoot
slightfoot / shopify.dart
Last active November 19, 2022 13:13
Shopify example app - by Simon Lightfoot - 05/11/2022
// MIT License
//
// Copyright (c) 2022 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@manofi21
manofi21 / juni.md
Last active July 30, 2023 10:52
my daily commit github #Daily
import 'package:provider/provider.dart';
extension ProviderStoreBuildContextX on BuildContext {
/// Read the store once, doesn't subscribe a BuildContext to update.
AppStore readStore() => read<AppStore>();
/// Watch the store by subscribing to a BuildContext.
AppStore watchStore() => watch<AppStore>();
/// Select a piece of the store, subscribing a BuildContext to update only
@override
void setState(fn) {
super.setState(fn);
}
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'method.dart';
import 'getterSetter.dart';
import 'widget.dart';
// stateless ini akan menjadi widget model. Widget model ini akan berisi List TextField dinamis //
// List TextFielld akan menyesuaikan dengan banyak panjang list String atau Function(String). //
// panjang LIst<String> dan List<Function(String)> harus sama//
class WidgetEditGist extends StatelessWidget {
  1. buat model

  2. buat function

  3. buat widget

  4. buat home

- provider: ^3.0.0+1
import 'package:flutter/material.dart';
import 'package:flutter_grocery_shopping/application_color.dart';
import 'package:geolocator/geolocator.dart';
import 'package:provider/provider.dart';
class ProvdersApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
  1. initialValue dan controller akan menghasilkan error jika ada di TextFormField yang sama

  2. ketika mentimpan menggunakan onSaved TextFormField, jangan lupa menggunakan validator dan mengecek validasi dari TextFOrmFIedl dengan Syntax "formKey.currentstate.validated" dan janga "formKey.currentState.saved" di Buttom

  3. Ketika ingin memisahkan widget di kelas / file yang berbeda. Pastikan pada variable VoidCallback tidak perlu menggunakan lambda. contoh: onPressed: callback jangan onPressed: ()=> callback

  4. Refresh indicator hanya bisa melakukan refresh di ListView