import 'package:flutter/material.dart';
void main() { runApp(SomeWidget()); }
class SomeWidget extends StatefulWidget { @override State createState() => SomeWidgetState(); }
import 'dart:math' as math; | |
import 'package:flutter/material.dart'; | |
class DropExtraChildren extends StatelessWidget { | |
final double spacing; | |
final List<Widget> children; | |
const DropExtraChildren({ | |
super.key, | |
required this.spacing, |
import 'package:flutter/material.dart'; | |
class DropExtraChildren extends StatelessWidget { | |
final Axis direction; | |
final double spacing; | |
final List<Widget> children; | |
const DropExtraChildren({ | |
super.key, | |
this.direction = Axis.horizontal, |
import 'package:flutter/material.dart';
void main() { runApp(SomeWidget()); }
class SomeWidget extends StatefulWidget { @override State createState() => SomeWidgetState(); }
mport 'package:flutter/material.dart'; | |
void main() { runApp(SomeWidget()); } | |
class SomeWidget extends StatefulWidget { @override State createState() => SomeWidgetState(); } | |
class SomeWidgetState extends State { int count = 0; | |
void incrementCount() => setState(() => count++); |
import React, {useState, useEffect} from 'react'; | |
const FlashCardGame = () => { | |
const [score, setScore] = useState(0); | |
const [quesNum, setQuesNum] = useState(0); | |
const [questions, setQuestions] = useState([]); | |
useEffect(() => { | |
generateQuestions(); |
// Controller | |
class TodoController { | |
constructor(api) { | |
this.api = api; | |
} | |
async getAllTodos() { | |
const todos = await this.api.getAllTodos(); | |
return todos; | |
} |
Write a TODO app in FLutter using a Rest API to read and write data. Encapsulate business logic in a dedicated controller class. | |
//Imports | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
import 'dart:convert'; | |
//Todo Controller class | |
class TodoController { | |
//Get all todos |
#!/bin/bash | |
flutter clean | |
rm -rf $FLUTTER_ROOT/.pub-cache | |
rm -rf $HOME/Library/Caches/CocoaPods | |
rm -rf ios/Pods | |
rm -rf ios/build | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/ | |
rm -rf ~/Library/Caches/com.apple.dt.Xcode/ |
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
/// Click the content to expand / constact the card. | |
/// These overflow warnings are not helpful, and impact developer efficiency and joy. | |
// It would be nice to turn them off for this specific widget. | |
void main() { | |
runApp(MyApp()); | |
} |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
int _seed = DateTime.now().millisecondsSinceEpoch; | |
/// Globally accessible instance of `Random`. | |
/// Makes using random values as easy as `rnd(20)` or `rnd.getBool()`. | |
Random rnd = Random(_seed); | |
/// Sets the seed of the `rnd` global `Random` instance. |