title: How to use a local variable value out it function in flutter?
body: <p>I had received two values as parameters of a function and now I have to use that values out of that function but i am receiving null values for those values.</p>
  
  <pre><code>String title;
  String type;
  
  
  void _addNewMedicine(String medTitle, String medType) {
  
  title = medTitle;   // the value of medTitle is assigned to title
  
  type = medType;     // the value of medType is assigned to type
  
  final newMed = Items(productname: medTitle, type: medType);
  setState(() {
      _userMedicine.add(newMed);     
      },
  );
  }  
  </code></pre>
  
  <p>If I used <code>print(medTitle)</code> or <code>print(medType)</code> then the output is <code>null</code>.</p>
  
  <p>So please someone help!!!</p>
  
  <p>Thank you in advance...</p>