Change Flutter App Theme from Light to Dark

Tiempo de lectura: < 1 minuto Reading time: < 1 minute First, we need to add the provider dependency inside the pubspec.yaml file. dependencies: flutter: sdk: flutter provider: ^5.0.0 To modify the theme of an application, I’ll show an example below: import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; void main() { runApp( ChangeNotifierProvider( create: (context) => ThemeProvider(), child: MyApp(), ), ); } class ThemeProvider … Read more

Search Bar and Filter in Flutter Dart

Tiempo de lectura: < 1 minuto Reading Time: < 1 minute To create a search bar and filter a list, follow these simple steps: The list of elements we will display and filter is as follows: List<dynamic> tutorsData = [ { “name”: “Maria”, “email”: “example1_devcodelight@email.com”, “phone”: “1234567890” }, { “name”: “Laura”, “email”: “example2_devcodelight@email.com”, “phone”: “1234567890” }, { “name”: “Isma”, “email”: “example3_devcodelight@email.com”, … Read more

UTF-8 Encoding Solution when Receiving Data by Making a GET Request Using Flutter – Dart

UTF-8 Encoding Solution when Receiving Data by Making a GET Request Using Flutter – Dart

Tiempo de lectura: < 1 minuto Reading time: < 1 minute When making a GET request using Flutter and the Dart programming language, I encountered an error while trying to display certain data. The encoding error occurs when receiving information with some characters, and when displaying them in the user interface, they are not shown correctly. To fix the error shown ... Read more

Creating a Simple List in Flutter – Dart

Creating a Simple List in Flutter – Dart

Tiempo de lectura: 3 minutos Reading time: 3 minutes To create an example list where we can add an element, update the list, and also remove elements, follow these steps: First, we create the main Widget that we call from main, where we display the .dart class with the designed view. void main() => runApp(MyApp()); class MyApp extends StatelessWidget { … Read more

Flutter – Structure of an API POST Call

Flutter – Structure of an API POST Call

Tiempo de lectura: < 1 minuto Reading time: < 1 minutes The structure for making a call from Flutter to an API and sending parameters to receive data is as follows: First, we declare and initialize a variable with the API route, in this case, I call it uri: final uri = 'https://name/api/route'; Then, I declare the headers, content-type: final headers ... Read more

Flutter- structure call API -GET

Flutter- structure call API -GET

Tiempo de lectura: < 1 minuto Reading Time: < 1 minute The structure to make an API call and retrieve data in Flutter is as follows: First, declare and initialize a variable with the API endpoint, in this case, I’ll call it `uri`: final uri = ‘https://example.com/api’; Next, declare the headers, specifically the `Content-Type`: final headers = { ‘Content-Type’: ‘application/json’, }; … Read more

Error compiling a Flutter application with API connection

Error compiling a Flutter application with API connection

Tiempo de lectura: < 1 minuto html Copy code Reading time: < 1 minute When trying to run an application that makes an API call from Flutter, the following error occurs: Error: Cannot run with sound null safety, because the following dependenciesdon’t support null safety: package:http package:http_parser To fix this error, I followed these steps: First, in the Android Studio menu … Read more

Internationalization of Flutter Application Using .json Files

Internationalization of Flutter Application Using .json Files

Tiempo de lectura: 3 minutos Reading time: 3 minutes Internationalizing a flutter application is easy by following the following steps as I show below: First, we need to add the necessary dependencies in the pubspec.yaml file: flutter_localizations: sdk: flutter flutter_cupertino_localizations: ^1.0.1 Next, we create the directory structure with the .json files From the root of our project, we create a … Read more

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Binding has not yet been initialized in Android Studio – Flutter

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Binding has not yet been initialized in Android Studio – Flutter

Tiempo de lectura: < 1 minuto Reading time: < 1 minute Photo by Soumil Kumar from pexels To solve this error while working with Flutter in an Android Studio project, you need to go to the main.dart file. This class is where the application starts with the runApp() method. You simply need to add the following line of code inside the … Read more

ERROR:D8: Cannot fit requested classes in a single dex file (# methods: 98082 > 65536) en Android Studio – Flutter

ERROR:D8: Cannot fit requested classes in a single dex file (# methods: 98082 > 65536) en Android Studio – Flutter

Tiempo de lectura: 2 minutos Reading time: 2 minutes Photo by Marta Branco from Pexels To fix the following error in a Flutter project in Android Studio, follow these steps: Following the path shown below, navigate to build.gradle Once inside, add the following line of code. multiDexEnabled true A few lines below, still inside the build.gradle, within dependencies and below … Read more