<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Paolo Mazzon</title>
    <description>The latest articles on DEV Community by Paolo Mazzon (@nio74maz).</description>
    <link>https://dev.to/nio74maz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1106240%2Fc1cffeb3-480f-4f7a-8c8c-8e2889e74cb3.png</url>
      <title>DEV Community: Paolo Mazzon</title>
      <link>https://dev.to/nio74maz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nio74maz"/>
    <language>en</language>
    <item>
      <title>How to Manage ForeignKey</title>
      <dc:creator>Paolo Mazzon</dc:creator>
      <pubDate>Thu, 22 Jun 2023 08:02:50 +0000</pubDate>
      <link>https://dev.to/nio74maz/how-to-manage-foreignkey-1b53</link>
      <guid>https://dev.to/nio74maz/how-to-manage-foreignkey-1b53</guid>
      <description>&lt;p&gt;Hello, I have a page InsertRepair, I'm using RactiveForm and its widgets, for the choise of customers I used reactiveDropodownSearch that how items use a map of repairs loaded by state.customer.name. How to pass relative id at state.customer.name. (foreign key in table repairs on db) To formControl in main Class. I hope that You understand me.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'package:au79dt1_0/blocs/customer/customer_bloc.dart';
import 'package:au79dt1_0/widgets/custom_dropdw_search.dart';
import 'package:reactive_forms/reactive_forms.dart';

class InsertRepairFirstPage extends StatelessWidget {
  final String? controllerUserId;
  final String? controllerCustomerId;

  final FormGroup formGroup;
  const InsertRepairFirstPage(
      {Key? key,
      this.controllerUserId,
      this.controllerCustomerId,
      required this.formGroup})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        DropDownCustomer(
          nameController: controllerCustomerId,
          formGroup: formGroup,
        )
      ],
    );
  }
}

class DropDownCustomer extends StatelessWidget {
  const DropDownCustomer({
    super.key,
    required this.nameController,
    required this.formGroup,
  });

  final String? nameController;
  final FormGroup formGroup;

  @override
  Widget build(BuildContext context) {
    return BlocBuilder&amp;lt;CustomerBloc, CustomerState&amp;gt;(builder: (context, state) {
      if (state is CustomerGetAllLoadedState) {
        return CustomDropDwSearch(
          formControlName: nameController,
          titlePopUp: 'Select Customers',
          labelText: 'Customers',
          items: state.customers
              .map((customer) =&amp;gt; customer.name.toString())
              .toList(),
        );
      }
      return Container();
    });
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>flutter</category>
      <category>help</category>
      <category>reactiveform</category>
    </item>
  </channel>
</rss>
