Posts by Naslausky • 2,350 points
96 posts
-
-4
votes1
answer63
viewsA: How to break a line in the print of a python list?
You can use List comprehension to call the function print on each element of the list: [print(nome) for nome in listasorteio] As the function print already contains the line break, must return the…
-
0
votes1
answer30
viewsA: Display Future variable on an Elevatedbutton
The variable is undefined because it was not defined in the scope you are trying to use it. If you declare a variable within a function, it will only be visible to that function: void funcao(){…
-
1
votes1
answer38
viewsA: Use flutter Icon class by code
The page you are browsing, https://pub.dev/documentation/flutter_for_web/latest/material/Icons-class.html If you notice correctly, it is not the official Flutter documentation page. It starts with…
-
2
votes3
answers79
viewsA: Select right line with Split in TXT
An easier way to read the file is to use the structure: def extrai_linha_txt(nome_arquivo: str, numero_linha: int): with open(file=nome_arquivo, mode='r', encoding='utf8') as fp: linhas =…
-
7
votes3
answers156
viewsA: How to join 2 lists in a dictionary?
What you want is the internal function zip() (documentation). This function takes a list of iterators, and returns a new iterator, in which each element is a tuple contained by a corresponding…
-
0
votes1
answer116
viewsA: error: The argument type 'Jsobject' can’t be Assigned to the Parameter type 'Buildcontext'
You probably imported the library dart-js by mistake. This library has the property context that makes your code confuse and generate this error. Try removing the import: import 'dart:js'; //Remova…
-
1
votes1
answer46
viewsA: algorithm or reasoning to get close-averaged sets from a list
I believe there are many ways of addressing this problem. However, many of them involve an iterative method, such as minimizing a cost function. In this question we can see some ways to solve it. I…
-
0
votes2
answers66
viewsA: VIEW DICTIONARY ALPHABETICALLY - PYTHON
Generally speaking, I think the most appropriate solution would be to create a class that encapsulates the two information in two attributes. That way they would always be together, and you wouldn’t…
-
0
votes1
answer94
viewsA: Calculation of age using Dart
First get the value the user typed using your controller: String textoDataNascimento = dateController.text; //Exemplo:'30/04/1950' Remember to check if this string is valid (if for example it has…
-
1
votes1
answer56
viewsA: Flutter: equivalent CSS image-Rendering in Flutter
According to the documentation of that property, we have that pixelated means: When scaling the image up, the Nearest-neighbor Algorithm must be used, so that the image appears to be composed of…
-
4
votes2
answers87
viewsA: What is the relationship between unhashable and mutable?
Imagine you have a list: lista = [1,2,3,4,5,6,7,8,9,10] If you want to check if an element is present in this list, Python will need to traverse element by element and compare one to one: if (11 in…
-
0
votes1
answer45
viewsA: Trigger a tab function from another widget
Explaining the problem: You’re doing a check if (this.mounted). As the name says, this property specifies whether the widget in question is inserted in the Widgets tree or not. Documentation can be…
-
1
votes1
answer27
viewsA: White space between gridview.Builder items
The constructor used by you assumes a aspect ratio of 1.0 for each child widget GridView. - That is, a ratio of one square - that can be seen in the documentation here. This is a feature of this…
-
0
votes2
answers82
viewsA: Error in word "context" flutter
You created this function _buildListView. This is a function that creates a widget and returns an instance of it. As we can see in this answer, this is not the best practice in this case as it has…
-
3
votes3
answers141
viewsA: Shouldn’t Python none be semantically equal to SQL Null?
Python, None is a constant representing the only possible value class Nonetype. That is, None is an object and its Nonetype class adopts the standard Singleton. When you compare None with None, you…
-
1
votes1
answer34
viewsA: How to put two words in the same line?
There are several ways to do this. Most will depend on specifics of your text, such as where the cursor is, or whether there are only two parameters always, etc. I leave here a relatively simple way…
-
3
votes1
answer115
viewsA: How to remove double quotes from the beginning and end of a Dart variable?
Remove first and last character from a string: If you need to remove the first and last characters from a String, you can use something like: String A = "123456789"; String B = A.substring(1,…
-
0
votes1
answer81
viewsA: I would like to count a list of words in a.txt file using python
You can try using list comprehension: wordList = [ "12510537019", "21185356784", "22097245854", "16427169000", "12464413424", "13506742816", "11990657689"] ocorrencias = [counting("arquivo.txt",…
-
0
votes2
answers63
viewsA: problem with scanf
In its main function, figura is declared as a char. "Char" is short for Character, which is "Caractér" in English. It is a data format to represent only one character. If you want to save an entire…
-
0
votes1
answer91
viewsA: how to remove unnecessary commas using sed in the shell script?
I believe that the most correct way to solve this problem is to write a script that interprets the text, understands and divides the parts that matter to you to handle it more easily. (For example…
-
0
votes2
answers408
viewsA: How to use distinct to bring a single result of each Dart/Flutter item
As mentioned in the other responses, you can implement equals and hash in Dart, to use the Set() directly with the class Animes. This means that you can decide exactly how the program will judge…
-
0
votes2
answers62
viewsA: Remove numbers and special characters from a text, but not within a word
As an alternative to another answer: You can try to separate by words before, with a split, and perform the regex on each element: import re texto = "ol@ mundo, eu bebo H20 e nao fumo cig@rro…
-
2
votes1
answer1118
viewsA: How to pass variables from a reusable widget to a flutter screen?
Follow an example of suggestion: In your Appbar class, set a callback function as a parameter: class MenuGeral extends StatelessWidget implements PreferredSize { MenuGeral({this.callback}); final…
-
0
votes1
answer47
viewsA: List values in PHP with Checkboxlisttitle and set an id for each checkbox listed
All of its Checkbox are with the same behavior because what will dictate their state is the value you put on the property value: false,. That is, what will tell you if the Checkbox is checked or…
-
0
votes1
answer156
viewsA: How to change the size of the Dropdownbutton list?
Short answer: Officially there is no way to achieve the desired result. There are solutions (gambiarras) on the internet that adapt the original code to your goal. Long answer: Searching for class…
-
0
votes1
answer28
viewsA: Return repeated in action on the flutter login screen
Make the function onPressed also asynchronous button, and wait for completion of login function: [...] onPressed: () async { await logar(); _login == true ? print('s') : print('n'); } [...] How did…
-
0
votes1
answer118
viewsA: Listview is not displayed below a 'Container'
This is because your widgets are ordered as follows: -ListView externa - -> Alguns Texts - -> ListView _buildSuggestions() Listview is a widget that allows scroll of its content. Since it has…
-
0
votes1
answer384
viewsA: How to access the changed value of a variable of another class?
As pointed out in the comments, this topic is called state management (in English). About this, there are many applicable solutions and each has its pros and cons. Which one is best for your…
-
0
votes1
answer508
viewsA: Flutter: Upload user image
To solve your problems you can use the library path. Just remember to import at the beginning of your file: import 'package:path/path.dart'; receive the image format type, example ("image/png" or…
-
1
votes1
answer41
viewsA: Is there any way to display a component only if there is data in the json file to populate it?
Your code can be improved and refactored in some points, however, I attend to the focus of the question: You can use the ternary operator which Dart makes available. If the check is false, put to…
-
0
votes2
answers448
viewsA: How to remove back arrow from home screen (flutter)?
Instead of using the method push, that stack a new screen to your list of screens in the application, try using the pushAndRemoveUntil: IconButton( icon: Icon(Icons.exit_to_app), onPressed: (){…
-
0
votes1
answer262
viewsA: Can anyone solve this error by building a flutter project?
Following the detailed instructions in this Issue, make sure you’re using the latest version of the package path_provider. In his file pubspec.yaml, check out: dependencies: path_provider: ^1.6.24…
-
3
votes1
answer119
viewsA: Difference between merge to Pick Herry?
The cherry-pick takes as arguments a list of commit identifiers. That is, it is used as follows: git cherry-pick commit1 commit2 ... With this, it will pick up the difference that each of these…
-
1
votes1
answer111
viewsA: Python - Square root estimate
You must save the last approach before calculating the next: [...] else: Ri1=(Ri+numero/Ri)/2 Ri=Ri1 Cont=Cont+1 [...] On the second line, the command Ri=Ri1 makes the two numbers equal, that is,…
-
2
votes1
answer1128
viewsA: Error posting to Play Store (At the moment, the desired level of your app’s API is 28.)
According to the google guide (with this link in first paragraph) you need to modify the property targetSdkVersion of your app: Every APK has a targetSdkVersion in the manifest file, also known as…
-
1
votes1
answer533
viewsA: Save files from download directory with flutter
In the error message we can see that: path = 'Directory: '/Storage/Emulated/0/Download'/example.pdf' That is, he thinks the path provided by you is Directory:…
-
0
votes1
answer836
viewsA: Dart/Flutter: how to use return of one method in another method? both invoked in the Class Constructor
and would like to know how, in the constructor method, I trigger one of the methods only after the first one has already populated the necessary variables. In Dart, there is the keyword await. This…
-
1
votes1
answer365
viewsA: Automatic and real-time validation of each Text field
You did not provide an example, but this problem occurs because the initial text of each TextFormField (probably an empty string) already makes the validation return as false. So, in an initial…
-
8
votes1
answer283
viewsA: GIT LOG: How do I search for a commit through a specific message?
Of git log documentation we can see the parameters: --all: Lists commits from all branches, not just what you are. --grep=<pattern> to restrict the search to commits whose log message contains…
-
1
votes1
answer118
viewsA: Using Sharedpreferences to get the default setting in Flutter
Try putting a await before the call to BuscarParametros(): await parametros.BuscarParametros(); setState((){ _controllerURL.text = paremtros.url_api; }) You would have been notified since error if…
-
0
votes1
answer38
viewsA: Negation selector of . gitignore not working
Your file .gitignore is working as you wish in the repository root directory. However, if the desired files are inside sub-folders, you should add these sub-folders also in a denial of the…
-
0
votes1
answer36
viewsA: Concatenate string into C
The function fgets reads the string until the number of characters is read or until a new line (\n) or EOF to be found. If it finds a new line character, it adds it to the String. You have two…
-
5
votes1
answer100
viewsA: What is the meaning of the operator ":" after a Builder on Dart?
This is a variable initialization list. It is instructing you how to initialize class properties EditMyModelScreen based on the parameter passed in the constructor. The following code:…
-
1
votes1
answer81
viewsA: Git is allowing branch changes even with commit-free changes
[...] make any changes to a branch [...] First, if you made these changes and didn’t even do the commit nor the add, means you haven’t changed into any branch. It’s only in your local directory.…
-
1
votes2
answers398
viewsA: How to use GIT to list the changed files in the branch
You can use the command git diff with the option --name-only to list only the name of the files. See documentation. This command can be used with one or two parameters. With one it will compare the…
-
2
votes1
answer98
viewsA: How to send notification to all Onesignal users with Flutter
In the documentation of the method postNotification says that: Please note that you must specify at least one Onesignal user ID that the notification should be sent to, using the playerIds Property.…
-
0
votes2
answers82
viewsA: Problem with value animation in Flutter
Try re-creating the animation object with the updated values: void selectNumber(selectedNumber){ [...] numberTransitionAnimation = IntTween(begin: currentNumber, end:…
-
0
votes2
answers264
viewsA: Listview doesn’t update on the screen!
Its variable imoveis = []; is a variable of state. That’s because your screen depends on it to build. So first move it into the state class _HomePageState : class _HomePageState extends…
-
0
votes1
answer287
viewsA: How to create a reusable dropdownButton in Flutter
Try making this statement within the method initState: String selectedItem; @override void initState() { super.initState(); selectedItem = widget.sourceList[0]; } (This method should be overwritten…
-
2
votes1
answer70
viewsA: Creating Listeners in Gridview using a List Flutter
Along those lines: onTap: actions[index]["onTap"] != null ? actions[index]["onTap"](context) : null, There is the element actions[index]["onTap"](context). How did you put (context) this is not…