Giter VIP home page Giter VIP logo

riverpod's Introduction

<<<<<<< HEAD

ShoppingItemModel에 copyWith 메서드를 작성하여 toggle 관련 함수 코드를 간결화하는 방법

// select_provider.dart
toggleHasBought(){
    state = ShoppingItemModel(
      name: state.name,
      quantity: state.quantity,
      hasBought: !state.hasBought,
      isSpicy: state.isSpicy,
    );
  }

shopping_item_model.dart 내의 ShoppingItemModel에 copyWith 메소드를 추가

// shopping_item_model.dart
ShoppingItemModel copyWith({
  String? name,
  int? quantity,
  bool? hasBought,
  bool? isSpicy,
}) {
  return ShoppingItemModel(
    name: name ?? this.name,
    quantity: quantity ?? this.quantity,
    hasBought: hasBought ?? this.hasBought,
    isSpicy: isSpicy ?? this.isSpicy,
  );
}

copyWith 메소드를 사용하여 코드를 간결화

// select_provider.dart
  toggleHasBought() {
    state = state.copyWith(
      hasBought: !state.hasBought,
    );
  }

=======

r_study

parent of 77e517a (�Docs : ShoppingItemModel에 copyWith 메서드를 작성하여 toggle 관련 함수 코드를 간결화하는 방법)

A new Flutter project.

Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.