This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
String str = "one.two"; | |
print(str.replaceAll(".two", "")); | |
// or | |
print(str.split(".").first);// split() will split from . and gives new List with separated elements. | |
// or | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
//this is what you need to have for flexible grid | |
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | |
//below two imports for fetching data from somewhere on the internet | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
//boilerplate that you use everywhere |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(new QuoteApp()); | |
class QuoteApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Motivational Quote App', | |
home: new Scaffold( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: MyHomePage(), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
String text = "Test #/first1hashtag test #/second2hashtag test."; | |
RegExp exp = new RegExp(r"\B#\/"); | |
exp.allMatches(text).forEach((match){ | |
print(match.group(0)); | |
text = text.replaceAll(match.group(0), ""); | |
}); | |
print(text); | |
String text2 = "Test #/first1hashtag test #/second2hashtag test."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var locations = { | |
{ | |
'country': 'Egypt', | |
'city': 'Cairo', | |
'Latitude': 30.033333, | |
'Longitude': 31.233334, | |
'utcOffset': 2 | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Map parentMap = { | |
'childOne': { | |
'grandSon': { | |
'grandGrandChild': { | |
'childOne': 'John', | |
'childTwo': 'Ron' | |
} | |
}, | |
'grandDaughter': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
List<Map> _pecasList = []; | |
List<String> alphas = ["a", "b", "c"]; | |
Map<String, dynamic> newPecas = Map(); | |
for (String c in alphas) { | |
if (c.isEmpty || c.trimLeft() == "") { | |
print("Campo Vazio"); | |
} else { |
NewerOlder