Relative Content

Tag Archive for flutterdartvisual-studio-code

I was writing Flutter code using flexible, and something happened that I didn’t understand

import ‘dart:async’; import ‘package:flutter/material.dart’; class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); @override State<HomeScreen> createState() => _HomeScreenState(); } class _HomeScreenState extends State<HomeScreen> { static const twentyFiveMinutes = 1500; int totalSeconds = twentyFiveMinutes; bool isRunning = false; int totalPomodoro = 0; late Timer timer; void onTick(Timer timer) { if (totalSeconds == 0) { setState(() { totalPomodoro = […]

flutter import files in the same project: which is better?

my_app/lib/ foo1.dart foo2.dart foo2.dart references some classes in foo1.dart. import “foo1.dart” import “package:my_app/foo1.dart” VSC dart editor can add either of above automatically. Which one should be used? The second one contains the project name (my_app). If the project name is changed, all the imports in code needs to be changed. If the first one is […]